Hello all,
I have two vectors XN and YN. Their values are mentioned in the excel file attached. I want to plot YN vs XN. when I enter following code: plot(XN,YN) I didn't get any result. But when I enter plot(YN,XN), matlab shows me correct plot.
Can you please help me to resolve this issue, why MATLAB is plotting x vs y but not y vs x?
Thank you in advance
Nikhil

 採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 3 日

0 投票

Maybe because your values are very small, try this
plot(x,y*1e+152)

3 件のコメント

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 3 日
After the plot, you can change the yticks to get the real values displayed in your plot
Nikhil
Nikhil 2014 年 1 月 3 日
Hey,
Thank you for your answer. It works this way. But if MALTAB can plot(y,x) without multiplying by any factor, why can't it just plot(x,y)....?
Thanks again, Nikhil
Youssef  Khmou
Youssef Khmou 2014 年 1 月 4 日
it worked without amplifying factor, this issue is not clear yet ...

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

その他の回答 (1 件)

Youssef  Khmou
Youssef Khmou 2014 年 1 月 3 日
編集済み: Youssef Khmou 2014 年 1 月 3 日

0 投票

Nikhil,
with the file you posted, it plots correctly y=f(x) which has a peak in the abscissa x=4.
G=xlsread('file.xlsx');
x=G(:,1)
y=G(:,2)
plot(x,y)

1 件のコメント

Nikhil
Nikhil 2014 年 1 月 3 日
Hey,
I am still not getting this plot. I am getting figure for plot(y,x) but I am getting blank figure for plot(x,y). I think there might be issue with version of Matlab I am using. Any help in this regard would be appreciated.
Thanks,
Nikhil

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

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by