How to enter 2 columns from an array into 1 input?

조회 수: 5 (최근 30일)
Tyler
Tyler 2012년 11월 5일
Loaded in a set of data containing 3 columns of info.
column 1 is H (height) and 2 and 3 are measurements (say of R) where the x values are col 2 and y values are col 3.
i need to plot a graph where h is the horiz axis and R on the vertical axis.
how would i go about making essentially the x and y 1 axis so h can be the other?

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 5일
편집: Azzi Abdelmalek 2012년 11월 5일
[ax,h1,h2]=plotyy(h,x,h,y)
  댓글 수: 4
Tyler
Tyler 2012년 11월 5일
편집: Tyler 2012년 11월 5일
ok that worked perfectly. Im doing multiple plots, how would i denote them as say figure 1, fig 2, fig3 ,etc.
when i do them all (the multiple plotyy's) i get a figure 1 and that is it.
edit: if i can i want them to show up at the same time and not interfere iwht each other.
Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 5일
do you mean
plotyy(h,x,h,y);
figure
plotyy(h,x1,h,y1)
figure
plotyy(h,x2,h,y2)

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2012년 11월 6일
I wonder if you want
plot(sqrt(x.^2 + y.^2), h);
  댓글 수: 2
Image Analyst
Image Analyst 2012년 11월 6일
But he wanted h on the horizontal axis and R on the vertical. I guess R = sqrt(x.^2 + y.^2). So wouldn't it be plot(h, sqrt(x.^2 + y.^2))?
Walter Roberson
Walter Roberson 2012년 11월 6일
Right. I was reading off from the last line of the Question which implicitly used the other order.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by