Can't see my text on a plot, but only for some values
Afficher commentaires plus anciens
Hey there, I'm trying to put on a text on the max value in a graph of solutions for second ODE. The equations depends on a variable n. In some cases I can see the text on the graphs and in others I can't - depend what is the value of n.
this is my code and my text info, the odefun function gives a solution for this ODE :
x^2*y''+x*y'+(x^2-n^2)=0
[x, Y]= ode45(@odefun, [0.5, 20], [1 1]);
figure;
plot(x,Y);
title('Y as a function of x');
xlabel('x');
ylabel('Y(x)');
max_value=max(Y)
max_x=max_value(1)
max_y=max_value(2)
txt='Max Value';
text(max_x, max_y, txt,'FontSize', 10, 'color', 'red', 'VerticalAlignment', 'top');
end
1 commentaire
Rik
le 5 Jan 2018
The only thing I can think of is that the solution might be outside of your axis area, but that seems unlikely.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!