How to use findpeaks command?

When I use the command "[pks,locs] = findpeaks(Avg,cx1)" I am getting error as
Error using uddpvparse (line 122) Invalid Parameter/Value pairs.
Error in findpeaks>parse_inputs (line 84) hopts = uddpvparse('dspopts.findpeaks',varargin{:});
Error in findpeaks (line 59) [X,Ph,Pd,Th,Np,Str,infIdx] = parse_inputs(X,varargin{:});
Error in paper6 (line 129) [pks,locs] = findpeaks(Avg,cx1)
What should I do? please help me.

Answers (1)

Star Strider
Star Strider on 26 Oct 2015
What are the sizes of Avg and cx1? If cx1 is a vector, it must be the same size as Avg.

6 Comments

Both having the same size. 21 datas each.
Avg=[190.2800 189.0000 187.7200 187.3200 185.6400 185.2000 186.7200 192.8000 199.5600 208.6400 209.0400 201.0800 193.0000 188.9200 184.7200 184.5200 185.4800 187.3600 188.7600 189.1200 189.0000]
cx1=[ 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420]
The code you posted works for me without error, and I get:
pks =
209.0400 189.1200
locs =
410.0000 419.0000
I have no idea why you’re getting the error. I can’t reproduce it.
Thank you for your valuable time. I am getting the same error. I don't know why. Is there any other function to find peak and its location?
My pleasure.
First, see if this works. Type these lines in your Command Window:
restoredefaultpath
rehash toolboxcache
Then run the findpeaks call again and see if it works. Otherwise, you might have to reinstall the Signal Processing Toolbox. Do other functions in the Signal Processing Toolbox work?
There are some peak finding functions on the File Exchange. Choose the one that works best for you.
I think I have to reinstall. Thank you so much.
You definitely have my sympathies.
My pleasure.

Sign in to comment.

Tags

Asked:

on 26 Oct 2015

Commented:

on 26 Oct 2015

Community Treasure Hunt

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

Start Hunting!