Peak to Peak Distance Help

조회 수: 4 (최근 30일)
Jake Larson
Jake Larson 2013년 1월 22일
답변: Greg Dionne 2014년 2월 6일
So I have a large data set of monthly averages which came in as a vector of 5000 or so points. I converted into 12x235 a matrix and then averaged each column to give me a vector of yearly averages for the data. The data resembles a sin curve and I need to find the distance between each peak. When I tried to use the peak to peak function, [pks,locs]=findpeaks(data,'minpeakdistance',3), it told me it could not compute it for type double. I tried converting to int and no luck. Please help.
  댓글 수: 3
Image Analyst
Image Analyst 2013년 1월 23일
Are you sure it says it "could not compute it for type double", or does it really say "
Error using findpeaks (line 43)
Input arguments must be 'double'.
"? Because that's the complete opposite of what you said.
Jake Larson
Jake Larson 2013년 1월 23일
[pks,locs]=findpeaks(x,'minpeakdistance',3)
Undefined function 'findpeaks' for input arguments of type 'double'.
I have no clue why it won't work for type double?

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

답변 (2개)

Leandro
Leandro 2013년 1월 22일
편집: Leandro 2013년 1월 22일
The findpeaks needs data to be a double variable, not ints.
data=double(data)
[pks,locs]=findpeaks(data,'minpeakdistance',3)
  댓글 수: 1
Jake Larson
Jake Larson 2013년 1월 23일
I have it in doubles. This is the error i get
Undefined function 'findpeaks' for input arguments of type 'double'.

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


Greg Dionne
Greg Dionne 2014년 2월 6일
It looks like you don't have the Signal Processing Toolbox.
You get that error when you try accessing a function that doesn't exist.
Try:
>> [pks,locs]=completelyundefinedfunction(x,'minpeakdistance',3) Undefined function 'completelyundefinedfunction' for input arguments of type 'double'.

카테고리

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