Plotting values results in an empty plot

1 回表示 (過去 30 日間)
Yash Runwal
Yash Runwal 2020 年 9 月 24 日
編集済み: Yash Runwal 2020 年 9 月 24 日
Hello,
So I have a function which returns the x and y coordinates like following:
ans =
0 0
0.0333 -0.0000
0.2333 -0.0000
0.6329 -0.0005
1.2312 -0.0021
2.0279 -0.0054
3.0246 -0.0087
4.2158 -0.0096
5.5612 -0.0071
7.0035 -0.0030
8.4943 0.0001
10.0031 0.0012
So I tried plotting plot(ans(1), ans(2)) but it outputs an empty plot.
My first thought was that because the ans(2) values are close to 0 the plot is empty and therefore I tried to change the ylim but couldn't get it to work.
Any ideas as to what can be done?
Thank You.
  2 件のコメント
VBBV
VBBV 2020 年 9 月 24 日
編集済み: VBBV 2020 年 9 月 24 日
%if true
% code
% end
plot(ans(:,1),ans(:,2))
Try the above it works without problem
Yash Runwal
Yash Runwal 2020 年 9 月 24 日
編集済み: Yash Runwal 2020 年 9 月 24 日
Hey yes it works, thank you

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

採用された回答

Alan Stevens
Alan Stevens 2020 年 9 月 24 日
Try
plot(ans(:,1),ans(:,2))
You were just plotting the first value against the second, not one column against the other.
  1 件のコメント
Yash Runwal
Yash Runwal 2020 年 9 月 24 日
I cannot believe I didn't notice that. Wow, I think I need a coffee. But thanks!!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by