Why doesn't my graph show?

>> x = 50e+12: 10e+12: 150e+12;
>> y = (7.9)*(((2e+14)*x)./((4*x.^2)+(5e+12)));
>> plot(x,y)
i need this to plot like the first plot in my attachment...why doesnt it?

9 件のコメント

Walter Roberson
Walter Roberson 2017 年 12 月 19 日
The plot shows up for me when I copy and paste those lines.
chris henkel
chris henkel 2017 年 12 月 19 日
hi! The plot will show up but its not the same as the one in the attachment that i added to my question. could you point out the problem?
Michal Dobai
Michal Dobai 2017 年 12 月 19 日
I don't see the problem with your code. It will show your graph just fine. Problem might be that your graph doesn't look like the one in your homework assignment.
I recommend you to check the range of values in your x variable :)
So my question for you. Do you really have a problem with your graph not showing at all?
Michal Dobai
Michal Dobai 2017 年 12 月 19 日
Oh, I saw your comment after I post mine. So you DON'T have a problem with showing your graph. Then, as I wrote in my previous comment, i recomend you to check the x range you generating.
chris henkel
chris henkel 2017 年 12 月 19 日
thank you Michal. My graph does show, I guess I meant show correctly
chris henkel
chris henkel 2017 年 12 月 19 日
Michal, what would the code suppose to look like for a more correct x range??
Star Strider
Star Strider 2017 年 12 月 19 日
Michal Dobai
Michal Dobai 2017 年 12 月 19 日
Assuming your formula for y is correct, you can just change your x to:
x = *-50e+12*: 10e+12: 150e+12; %(or even -150E+12)
..and it suddenly looks more like in your assignment. But this is not really MATLAB question, it's more like a physics question and unfortunately I can't help you with that 'physics' part.
Michal Dobai
Michal Dobai 2017 年 12 月 19 日
Also, please avoid posting duplicate questions in future. You can always edit your original question, when you want to add some new information, or write a comment.

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

回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

質問済み:

2017 年 12 月 19 日

コメント済み:

2017 年 12 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by