フィルターのクリア

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 Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by