フィルターのクリア

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 Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by