필터 지우기
필터 지우기

how to select origin for plotting graph

조회 수: 1 (최근 30일)
Tejas Mahajan
Tejas Mahajan 2020년 10월 9일
댓글: Ameer Hamza 2020년 10월 9일
i have y=[1,5,8,3,9] and x has to be the origin from where the graph will have origin, suppose user want origin a y[8] so point(0,8) will be the origin and the other points will be according to that.Please help me with this.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 10월 9일
편집: Ameer Hamza 2020년 10월 9일
Suppose in this case you want origin at y(3)
y= [1,5,8,3,9];
n = 3;
x = -(n-1):numel(y)-n; % or x = (0:numel(y)-1)-n+1;
plot(x, y);
  댓글 수: 2
Tejas Mahajan
Tejas Mahajan 2020년 10월 9일
Can you please explain it to me
Ameer Hamza
Ameer Hamza 2020년 10월 9일
By default, the plot starts y(1) at x=1. If you want to start y(3) at x=0, then you need to move y(1) to -2. This is happening in the above code.

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

추가 답변 (0개)

카테고리

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