How can I show the max point on a plot ?
72 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am having hard time figuring out a way to show the max point on a plot
1 commentaire
Réponses (1)
Star Strider
le 18 Avr 2020
Depending on what you want to do, and if there is only one maximum:
x = 0:10;
y = -(x-5).^2;
[ymax,idx] = max(y); % Maximum Of Dependent Variable & Index
figure
plot(x, y)
hold on
plot(x(idx), ymax, '^r')
hold off
grid
ylim([min(ylim) max(ylim)+1])
.
0 commentaires
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!