Azzera filtri
Azzera filtri

Unable to get a plot in a Graph

2 visualizzazioni (ultimi 30 giorni)
jack carter
jack carter il 14 Apr 2017
Commentato: jack carter il 14 Apr 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?

Risposta accettata

Stephen23
Stephen23 il 14 Apr 2017
Modificato: Stephen23 il 14 Apr 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 Commento
jack carter
jack carter il 14 Apr 2017
Thank you for your detailed answer, it has solved the problem

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graph and Network Algorithms in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by