필터 지우기
필터 지우기

Unable to get a plot in a Graph

조회 수: 2 (최근 30일)
jack carter
jack carter 2017년 4월 14일
댓글: jack carter 2017년 4월 14일
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?

채택된 답변

Stephen23
Stephen23 2017년 4월 14일
편집: Stephen23 2017년 4월 14일
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
jack carter
jack carter 2017년 4월 14일
Thank you for your detailed answer, it has solved the problem

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by