How to find the maximum value of the power and its position on the time axis (x,y)?

1 visualización (últimos 30 días)
Need your help guys !
Need to find the max and the min of p , shown as [x,y].

Respuestas (1)

Torsten
Torsten el 15 de En. de 2023
Editada: Torsten el 15 de En. de 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 comentarios
Image Analyst
Image Analyst el 27 de En. de 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

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by