How to find the maximum value of the power and its position on the time axis (x,y)?
1 view (last 30 days)
Show older comments
Need your help guys !
Need to find the max and the min of p , shown as [x,y].
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1264355/image.png)
0 Comments
Answers (1)
Torsten
on 15 Jan 2023
Edited: Torsten
on 15 Jan 2023
s=1.25;
t1=0:0.01:pi/2;
t2=pi/2:0.01:pi;
t=[t1 t2];
p1= 4*(sin(2*t1)).^2.*exp(-t1/s).^2 + 2;
p2= 4*(sin(2*t2)).^2.*exp(-t2/s) + 2;
[~,i1_min] = min(p1);
[~,i1_max] = max(p1);
[~,i2_min] = min(p2);
[~,i2_max] = max(p2);
figure()
hold on
plot([t1 t2],[p1 p2])
plot(t1(i1_min),p1(i1_min),'o',"Color","r")
plot(t1(i1_max),p1(i1_max),'o',"Color","r")
plot(t2(i2_min),p2(i2_min),'o',"Color","r")
plot(t2(i2_max),p2(i2_max),'o',"Color","r")
hold off
2 Comments
Image Analyst
on 27 Jan 2023
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.
By the way, you might look at findpeaks
See Also
Categories
Find more on Detection in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!