how to add text to my plot
Mostrar comentarios más antiguos
hi!
i want to write text on the plotted graph next to the min and max values of my function and i can't find it in the figure window
there is another options to find the min max values and write a text next to the graph?
thanks!
clear all
clc
t=0:0.01:2*pi;
s=1;
P=(4*sin(2.*t).*exp(-(t/s).^2)+2).*(0<=t<pi/2)+...
(4*sin(2.*t).*exp(-t/s)+2).*(pi/2<=t<=2*pi);
plot(t,P);
[a,b]=max(P);%
[c,d]=min(P);%
text(t(b),a,'maximum');%
text(t(d),c,'minimum');%
xlabel('time');
ylabel('power');
legend('p(t)');
title('power vs. time');
4 comentarios
ron tzuberi
el 22 de Jul. de 2019
Stephen23
el 22 de Jul. de 2019
ron tzuberi
el 22 de Jul. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


