how to select origin for plotting graph
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Tejas Mahajan
am 9 Okt. 2020
Kommentiert: Ameer Hamza
am 9 Okt. 2020
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.
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 9 Okt. 2020
Bearbeitet: Ameer Hamza
am 9 Okt. 2020
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 Kommentare
Ameer Hamza
am 9 Okt. 2020
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!