How can I solve findpeaks() error?

10 ビュー (過去 30 日間)
Ezz El-din Abdullah
Ezz El-din Abdullah 2017 年 8 月 27 日
コメント済み: Ganavi Mg 2018 年 2 月 7 日
I'd like to fix this error that appears when I use findpeaks:
Error using findpeaks
Expected X to be finite.
Error in findpeaks>parse_inputs (line 215)
validateattributes(Xin,{'double'},{'real','finite','vector','increasing'},'findpeaks','X');
Error in findpeaks (line 134)
= parse_inputs(Yin,varargin{:});
Thank you.
Edit:
I have attached the data which I would like to find the peaks on.
  1 件のコメント
Ganavi Mg
Ganavi Mg 2018 年 2 月 7 日
Hi Even I am getting same error. Please give some suggestions.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'); data = size(sig(2,1:1000)); pks= findpeaks(data,sig(1:1000));

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 8 月 27 日
findpeaks() does not work on data that includes +/- inf or nan. You will need to remove that data before running findpeaks()
xfin = min(realmax, max(-realmax, x));
if any(isnan(xfin(:)))
error('Sorry, cannot compensate for nan data');
end
findpeaks(xfin, ...)
  5 件のコメント
Ezz El-din Abdullah
Ezz El-din Abdullah 2017 年 8 月 27 日
The data is attached.
I used the command:
[locs,pks]=findpeaks(y,x)
Walter Roberson
Walter Roberson 2017 年 8 月 28 日
The data does not appear to have been attached yet.
yfin = min(realmax, max(-realmax, y));
if any(isnan(yfin(:)))
error('Sorry, cannot compensate for nan data');
end
findpeaks(yfin, x)

サインインしてコメントする。

カテゴリ

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