Unable to get a plot in a Graph

4 views (last 30 days)
jack carter
jack carter on 14 Apr 2017
Commented: jack carter on 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?

Accepted Answer

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

Sign in to comment.

More Answers (0)

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!