Plotting a row from a matrix

조회 수: 174 (최근 30일)
BubbleFlow
BubbleFlow 2018년 12월 30일
댓글: BubbleFlow 2018년 12월 30일
Hello,
I'm new to matlab. So forgive me if this is a stupid question. I'm analyzing some MATLAB code, and there is a line which plots the 1000th row of a matrix. However I don't understand where the y-values come from. Where do the y-valus come from?
Here is a link to the csv file of INT_I:
The code is:
figure('Name','INT 1000','NumberTitle','off'); hold on;
set(gca,'FontSize',30)
plot(INT_I(1000,:))
legend('1','2','3')
What I get is this:
  댓글 수: 1
Stephen23
Stephen23 2018년 12월 30일
"Where do the y-valus come from"
Your data.
Where do the X values come from? Read the plot help to find out.

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

채택된 답변

Michael Madelaire
Michael Madelaire 2018년 12월 30일
편집: Michael Madelaire 2018년 12월 30일
INT_I(1000,:)
That is your y-values
plot(INT_I(1000,:))
Is equivalent to
plot(1:length(INT_I(1000,:)), INT_I(1000,:))
Due tell if it is not clear
  댓글 수: 2
Stephen23
Stephen23 2018년 12월 30일
Which is also exactly what the plot documentation states:
"plot(Y) creates a 2-D line plot of the data in Y versus the index of each value."
"If Y is a vector, then the x-axis scale ranges from 1 to length(Y)."
BubbleFlow
BubbleFlow 2018년 12월 30일
I understand now. Thank you.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by