plot(x,y(1,:) meaning

조회 수: 4 (최근 30일)
Chloe
Chloe 2019년 10월 5일
댓글: Rena Berman 2019년 10월 28일
Hi,
I'm new matlab. I was wondering what the y(1,:) means?
I have ran this code: plot(x,y(1,:),'r-o',x,y(2,:),'g*','LineWidth',2) and can't make sense of the 1 and 2 in regards to the y coordinate.
Thanks
  댓글 수: 3
Stephen23
Stephen23 2019년 10월 26일
Original question (from Google Cache):
I'm new matlab. I was wondering what the y(1,:) means?
I have ran this code: plot(x,y(1,:),'r-o',x,y(2,:),'g*','LineWidth',2) and can't make sense of the 1 and 2 in regards to the y coordinate.
Thanks
Rena Berman
Rena Berman 2019년 10월 28일
(Answers Dev) Restored edit

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

답변 (1개)

Star Strider
Star Strider 2019년 10월 5일
편집: Star Strider 2019년 10월 5일
It means the first row of the ‘y’ matrix. See Matrix Indexing for details.
EDIT —
To illustrate:
y = [1 2 3 4 5; 6 7 8 9 10]
FirstRow = y(1,:)
SecondRow = y(2,:)
produces:
y =
1 2 3 4 5
6 7 8 9 10
FirstRow =
1 2 3 4 5
SecondRow =
6 7 8 9 10

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by