How can i extend my graph to a certain point in the graph

22 views (last 30 days)
x=[0,.4,.6,.8,1,1.2,1.6,2,2.2,2.5,2.8,3.2,3.4,3.6,3.8,4,4.4,5,5.6,5.8,6.3,6.8,7.3,7.8,8,8.5,8.8,9.5,10,10.5,11,11.4,12,12.6,13.2,14];
z=[14.2,36.3,49.7,59.9,69.1,81.9,107.7,120,149.9,160,176,196,210,224,236,244,268,292,316,324,340,352,364,376,384,392,402,416,422,428,436,442,444,450,456,468];
plot(x,z);
set(gca,'XTick',0:1:20)
%how can i extend this graph to apoint x>16

Answers (2)

Chaowei Chen
Chaowei Chen on 27 Aug 2011
I think you probably just want to do
axis([0 16 0 500])

Walter Roberson
Walter Roberson on 27 Aug 2011
Are you asking about extrapolation of the graph beyond your last x value?
If so, then you need to decide how you want to do the extrapolation. You could do linear extrapolation from the last two points, or you could do cubic interpolation from the last three points. Usually these options are not very satisfactory.
To get better extrapolation, you would want to do curve fitting of the known data, and use the coefficients you obtain to plot out to your desired point.
If you want to do curve fitting, then you have the problem that there is no "right" or "wrong" method of curve-fitting, that there are literally an infinite number of different curves that can be fit to the same data and there is no mathematical way of deciding that one of them is the "right" curve.
Because of this, if you want to do curve fitting, you really should already have a mathematical model of what the structure of the equations should be: then you use the data to find the coefficients that best match the structure of the equation to the data.
The calls you would use within MATLAB to do the curve fitting would depend upon the structure of the equation you want to fit to, and also upon which toolboxes you have.

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!