How to find the maximum value of the power and its position on the time axis (x,y)?
1 次查看(过去 30 天)
显示 更早的评论
Need your help guys !
Need to find the max and the min of p , shown as [x,y].
0 个评论
回答(1 个)
Torsten
2023-1-15
编辑:Torsten
2023-1-15
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 个评论
Image Analyst
2023-1-27
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Detection 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!