plotting a simple Graph

2 ビュー (過去 30 日間)
Shimon Katzman
Shimon Katzman 2019 年 12 月 24 日
コメント済み: Star Strider 2019 年 12 月 25 日
Hi everyone,
Trying to plot a graph unsucssesfully :((
alpha=2.2;
Mx0=34.8262;
My0=15.7563;
Mx=linspace(0,50,0.0001);
Interaction_Curve=(Mx./Mx0).^alpha+(My./My0).^alpha-1
plot(Interaction_Curve,Mx)
Thank You Very much
  2 件のコメント
madhan ravi
madhan ravi 2019 年 12 月 24 日
You didn’t define My and you haven’t used the linspace() properly for Mx.
Shimon Katzman
Shimon Katzman 2019 年 12 月 24 日
編集済み: Shimon Katzman 2019 年 12 月 24 日
So what is the correct way?

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2019 年 12 月 24 日
One problem is that ‘My’ is missing. Beyond that, the linspace arguments resulted in an empty vector for ‘Mx’.
It might be easier to plot this as an implicit function:
alpha=2.2;
Mx0=34.8262;
My0=15.7563;
Interaction_Function = @(Mx,My) (Mx./Mx0).^alpha+(My./My0).^alpha-1;
figure
fimplicit(Interaction_Function, [0 50 0 30])
ylim([0 30])
producing:
1plotting a simple Graph - 2019 12 24.png
That seems to produce the sort of plot you want. Make appropriate changes to the second agrument in the fimplicit call to get the result you want.
  9 件のコメント
Shimon Katzman
Shimon Katzman 2019 年 12 月 25 日
Wow Star. Thank you so much!!
You Are The Best!
Star Strider
Star Strider 2019 年 12 月 25 日
As always, my pleasure!
I very much appreciate your compliment!

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2019 年 12 月 24 日
Try this:
alpha = 2.2;
Mx0 = 34.8262;
My0 = 15.7563;
Mx = linspace(0,50, 1000);
My = linspace(0,50, 1000); % Not sure what My should be!!!
Interaction_Curve = (Mx./Mx0).^alpha+(My./My0).^alpha-1
plot(Mx, Interaction_Curve, 'b-', 'LineWidth', 2)
grid on;
Be sure to define My because I just guessed incorrectly.
  2 件のコメント
Shimon Katzman
Shimon Katzman 2019 年 12 月 24 日
Hi, it doesnt plot the right graph :(
Image Analyst
Image Analyst 2019 年 12 月 24 日
I know. Because I don't have the value of the My variable. That's why I asked you to define it. What is it? But doesn't matter since it looks like Star figured it out.

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by