Why am I getting error while running code of mathworks website?

조회 수: 1 (최근 30일)
Explorer
Explorer 2016년 2월 9일
답변: John BG 2016년 2월 10일
load sunspot.dat
year=sunspot(:,1);
relNums=sunspot(:,2);
findpeaks(relNums,year);
xlabel('Year');
ylabel('Sunspot Number')
title('Find All Peaks');
I am getting below mentioned error. Why is it so?
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{:});
  댓글 수: 3
Explorer
Explorer 2016년 2월 9일
I did not get your question. What is class?
Explorer
Explorer 2016년 2월 9일
I am getting same error when I tried to run another code from MATLAB Documentation .
data = [25 8 15 5 6 10 10 3 1 20 7];
plot(data)
pks = findpeaks(data)
findpeaks(data)
x = linspace(0,1,1000);
Pos = [1 2 3 5 7 8]/10;
Hgt = [4 4 4 2 2 3];
Wdt = [2 6 3 3 4 6]/100;
for n = 1:length(Pos)
Gauss(n,:) = Hgt(n)*exp(-((x - Pos(n))/Wdt(n)).^2);
end
PeakSig = sum(Gauss);
plot(x,Gauss,'--',x,PeakSig)
[pks,locs] = findpeaks(PeakSig,x);
findpeaks(PeakSig,x)
text(locs+.02,pks,num2str((1:numel(pks))'))
Is this because of older version of MATLAB? I am using MATLAB R2013a.

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

채택된 답변

John BG
John BG 2016년 2월 10일
there is a uppvparse related compiler bug fix report 452577 (release 2008b) in
I tried the sunspot.dat initial lines and work fine in R2015.
There are 4 findpeaks related bugs 650368(2010b), 582260(2010a), 452577(2008b) same as above, and 489930(2009a).
I have also tried the code you added later on and no problem in 2015.
If I were you, if not out of experience, just for the cost of a student licence, it really pays off to save a few pizzas and beer, and get MATLAB updated, really.
is this answer helping you in any way to solve your question and take the right direction, please give me a thumbs-up vote by clicking above, next to your question, thanks in advance.
John

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 AI for Signals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by