필터 지우기
필터 지우기

Plot with a lag

조회 수: 5 (최근 30일)
alpedhuez
alpedhuez 2018년 6월 8일
편집: Brandon Free 2018년 6월 11일
Suppose I want to have plot of lagged x and y that belong in table T. For example, I want to have a plot that the first element of T.x is paired with second element of T.y, the second element of T.x is paired with the third element of T.y, etc. Please advise.

채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 8일
plot(T.x(1:end-1), T.y(2:end))

추가 답변 (1개)

Brandon Free
Brandon Free 2018년 6월 8일
편집: Brandon Free 2018년 6월 11일
Because you have to always have the same number of x and y data, you could accomplish this by deleting a few entries. Also note that tables work the same way, meaning you always have to have the same length of x and y, so you first have to transform the tables to regular vectors.
XData = T.x;
YData = T.y;
XData(1) = [];
YData(end) = [];
plot(XData, YData)
  댓글 수: 1
alpedhuez
alpedhuez 2018년 6월 8일
Thank you. Easier to understand.

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

카테고리

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