Hello.
I'm trying to plot (x,T) and want to just depict the upper limit curve. I tried to use other Matlab programs others have posted and the findpeaks equation, but I'm not getting much luck.
I want to plot this curve instead of filtering the data and distorting it in a way. Could anyone help me out please? Thank you for your time!

 채택된 답변

Mohammad Abouali
Mohammad Abouali 2014년 10월 19일

0 개 추천

How does this work for you?
load Example
[pks,locs]=findpeaks(T,x,'MinPeakDistance',3);
plot(x,T);
hold on
plot(locs,pks,'r','LineWidth',3)
The redline is the upper bound.

댓글 수: 5

dj
dj 2014년 10월 19일
It tells me the following: Error using findpeaks>parse_inputs (line 131) Expected a string for the parameter name, instead the input type was 'double'.
Error in findpeaks (line 71) [X,Ph,Pd,Th,Np,Str,infIdx] = parse_inputs(Xin,varargin{:});
Error in Example (line 2) [pks,locs]=findpeaks(T,x,'MinPeakDistance',3);
Sadly, I'm not seeing the redline. Would you know where I messed up?
Mohammad Abouali
Mohammad Abouali 2014년 10월 19일
편집: Mohammad Abouali 2014년 10월 19일
Which version of MATLAB do you have?
When I run above code I get the red line that you have in your rough sketch. I am out of the limit to upload any figures, I can just upload 10 figures a day.
Mohammad Abouali
Mohammad Abouali 2014년 10월 20일
편집: Mohammad Abouali 2014년 10월 20일
When I run the above code I get the following image:
If you have older matlab try this:
load Example
[pks,locs]=findpeaks(T,'MinPeakDistance',1500);
plot(x,T);
hold on
plot(x(locs),pks,'r','LineWidth',3)
dj
dj 2014년 10월 20일
Wow, typing x in front of (locs) makes THIS much difference? This is so weird. Yes, I do have R2013a version. Thank you, everyone. Sorry about the late feedback.
Mohammad Abouali
Mohammad Abouali 2014년 10월 20일
I am guessing the x was not supported in the former version of MATLAB. Not sure but I think even R2014a didn't support it.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

dj
2014년 10월 18일

댓글:

2014년 10월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by