Extrapolate using half the slope than in original data
Show older comments
I have a set of 21 X,Y poinst which I intend to extrapolate by using slope (rate of change)= 1/2 than that is observed in the original X,Y dataset.
The code thus far
Xext=22:82; (trying to extrapolate until limit= 82)
c = polyfit((X(end-8:end)), (Y(end-8:end)),1); % linear fit based on the last 8 points
c1=[c(1)/2, c(2)];%%making slope 1/2 of the original X,Y dataset
Yext = polyval(c1,Xext);
%%plotting to obtain a figure that shows the first 21 points changing at the observed rate and the next extrapolated to change at 1/2 its rate
Xn=[X,Xextrap(9:end)];
Yn=[Y,Yextrap(9:end)];
plot(Xn,Yn)
This makes a bit of an unwated hump where the extrapolation begins (see attached)
Any help is greatly appreciated
Accepted Answer
More Answers (0)
Categories
Find more on Linear and Nonlinear Regression 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!