Error in defining x values for peak analysis in Matlab
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Kasih Ditaningtyas Sari Pratiwi
el 23 de Oct. de 2017
Comentada: Ganavi Mg
el 7 de Feb. de 2018
Hi. I have a problem in creating plot for peak analysis. It can plot the data but not for the x-axis. My data is in the form of double, and my x-axis is datetime. However, when I plot findpeaks, I got an error warning :
"Error using findpeaks
Expected X to be increasing valued.
Error in findpeaks>parse_inputs (line 242)
validateattributes(seconds(Xin-Xin(1)),{'double'},{'real','finite','vector','increasing'},'findpeaks','X');
Error in findpeaks (line 136)
= parse_inputs(isInMATLAB,Yin,varargin{:});"
The value of my datetime data actually increase by the number of rows, so I wonder why I got an error. I attach the picture of my datetime data. Could you please help me? I have been working on this problem since morning and up to know I got nothing :(. Thank you for your help.
1 comentario
Ganavi Mg
el 7 de Feb. de 2018
Hi Even I got same error as you got. My code is clc; clear all; load('DATA_01_TYPE01.mat'); [n, p] = size(sig); t=1:n; plot((1:1000),sig(2,1:1000)); xlabel('samples') ylabel('sample amplitude') title('User1') figure; n=1000; ts =0.0001; ws = 2*pi/ts; f = fft(sig(2,1:1000)); w = ws*(-n/2:(n/2)-1)/n; plot(w,abs(f)) xlabel('frequency'); ylabel('amplitude'); title('fast fourier transform of PPG DATA'); [pks,locs]= findpeaks(frequency,sample amplitude); In the place of frequency,sample amplitude what value we must use. I need peak analysis of signal. The data is in .mat format. I had loaded the mat values in to my code, then found out the fft of the data. I need peak of the signals. What I should do now ?
Respuesta aceptada
Walter Roberson
el 23 de Oct. de 2017
I suspect you are using R2015b or earlier; datetime was not permitted for the "location" parameter until R2016a.
7 comentarios
Walter Roberson
el 24 de Oct. de 2017
You do not need most of that.
t = finalCSVnew{:,1};
tisdup = [false; diff(t(:)) == 0];
finalCSVnew(tisdup, :) = [];
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!