필터 지우기
필터 지우기

Error in defining x values for peak analysis in Matlab

조회 수: 1 (최근 30일)
Kasih Ditaningtyas Sari Pratiwi
Kasih Ditaningtyas Sari Pratiwi 2017년 10월 23일
댓글: Ganavi Mg 2018년 2월 7일
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
Ganavi Mg
Ganavi Mg 2018년 2월 7일
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 ?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2017년 10월 23일
I suspect you are using R2015b or earlier; datetime was not permitted for the "location" parameter until R2016a.
  댓글 수: 7
Walter Roberson
Walter Roberson 2017년 10월 24일
You do not need most of that.
t = finalCSVnew{:,1};
tisdup = [false; diff(t(:)) == 0];
finalCSVnew(tisdup, :) = [];
Kasih Ditaningtyas Sari Pratiwi
Kasih Ditaningtyas Sari Pratiwi 2017년 10월 24일
Awesome! Thank you so much Walter! You're really smart! Hopefully when later I am no longer a newbie in matlab programming, I can answer the question as you do. Thank you again :D

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by