Unable to get a plot in a Graph

2 vues (au cours des 30 derniers jours)
jack carter
jack carter le 14 Avr 2017
Commenté : jack carter le 14 Avr 2017
I need to plot a graph based as shown in the attached image. I have written the coding for the equation which is in attached image;
%First way: I defined it as a function and I got a graph but with no plot at all.
f = @(Le, P) pi*a*d*Le+sqrt((pi^2*G*E*d^3)/2);
ezplot(f, [0.0 Le])
%Second way: It would be helpful if you could also tell me how to plot if I write the equation coding by the following way;
P=pi*a*d*Le+sqrt(pi^2*Gd*Ef*df^3/2);
%The reason I write like the second way is because I am writing set of equations as a function, later I will solve this function to get a simulation.
Please note that the values of the other variables were already defined in the function as the following;
a=3.0, d=14, Le=0.46, G=6.0, E=60
I am getting a graph with no plot. I only need to get that line graph (as shown in the image) marked as "prediction", not the scattered (experiment) plot.
Can someone help me correct it please?

Réponse acceptée

Stephen23
Stephen23 le 14 Avr 2017
Modifié(e) : Stephen23 le 14 Avr 2017
Method One: ezplot:
>> a=3.0; d=14; G=6.0; E=60;
>> f = @(Le) pi*a*d*Le+sqrt((pi^2*G*E*d^3)/2);
>> ezplot(f, [0.0,1.2])
Method Two: plot:
>> Le = 0:0.01:1.2;
>> P = pi*a*d*Le+sqrt(pi^2*G*E*d^3/2);
>> plot(Le,P)
  1 commentaire
jack carter
jack carter le 14 Avr 2017
Thank you for your detailed answer, it has solved the problem

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graph and Network Algorithms 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!

Translated by