plotting x vs y but not y vs x.
조회 수: 6 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2014년 1월 3일
Maybe because your values are very small, try this
plot(x,y*1e+152)
댓글 수: 3
추가 답변 (1개)
Youssef Khmou
2014년 1월 3일
편집: Youssef Khmou
2014년 1월 3일
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)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!