x=-20:0.1:20;
f2=x.^10-1;
plot(x,f2)
Adsız.png
I cant understand why it sketches my basic code wrong.

5 件のコメント

Walter Roberson
Walter Roberson 2019 年 3 月 22 日
It looks right to me. You might have overlooked the "x 10^12" on the upper left of the y axis.
Stephen23
Stephen23 2019 年 3 月 22 日
編集済み: Stephen23 2019 年 3 月 22 日
Why is it wrong (apart from that you cut off the multiplier from the top of the y-axis)?
What do you expect to get?
Melih Aksoy
Melih Aksoy 2019 年 3 月 22 日
編集済み: Melih Aksoy 2019 年 3 月 22 日
was expecting to get graph of x^10-1 which is
Stephen23
Stephen23 2019 年 3 月 22 日
編集済み: Stephen23 2019 年 3 月 22 日
"was expecting to get graph of x^10-1 which is"
That is exactly what you already have. Again, you are just ignoring the multiplier at the top of the y-axis. Set the y-limits to [-1,3] and you will see the part of the curve that you expect.
Melih Aksoy
Melih Aksoy 2019 年 3 月 22 日
I am sorry but i am really new at MATLAB. How can i set y-limits?

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

 採用された回答

Stephen23
Stephen23 2019 年 3 月 22 日
編集済み: Stephen23 2019 年 3 月 22 日

1 投票

MATLAB has plotted exactly what you asked for, where the y-range ranges over:
>> x = -20:0.1:20;
>> y = x.^10-1;
>> max(y)
ans = 10239999999999
>> min(y)
ans = -1
Over that range of y-values I would not expect to be able to distinguish between 0 and -1, they will appear exactly the same on your monitor (unless you have a monitor with more than eleven trillion pixels vertically, in which case those two values will appear one pixel different from each other).
You can limit the plot's y-range if you want:
ylim([-1,3])
or reduce the x-domain:
x = -1.1:0.1:1.1;

1 件のコメント

Melih Aksoy
Melih Aksoy 2019 年 3 月 22 日
Thank you man! It's a big help.

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

その他の回答 (0 件)

カテゴリ

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

質問済み:

2019 年 3 月 22 日

コメント済み:

2019 年 3 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by