- I give you 1 US$ today, 2 US$ tomorrow and 4 US$ in 7 days. How much money will I give you in 2 months?
how to interpolate outside the domain of x?
5 次查看(过去 30 天)
显示 更早的评论
Dear friends,
I am doing some interpolation about GDP increase rate,please see the attached excel file. The result seems beyond my expectation, because
the increase rate drops exponetial in the next 50 years. I am not sure whether I am right or not. And How did I get the interpolation formula?
Your help would be highly appreciated.
clear
clc
close all
T = readtable('gdpincreaserate.xlsx',...
'Range','A2:B62',...
'ReadVariableNames',false) ;
A = table2array(T);
x=A(:,1);
y=A(:,2);
plot(x,y,'-o')
hold on
xq=2022:2072;
yq = interp1(x,y,xq,'pchip');
plot(xq,yq)
1 个评论
Jan
2022-11-8
编辑:Jan
2022-11-8
What do you expect instead? Note that there is an infinite number of functions to fit these data. An extrapolation is pure guessing, if you do not have a model, which defines a function to be fitted.
If you e.g. fit the parameters of a polynomial, the values outside the defined range will explode soon. With fitting a sine wave, you can be sure, that the data are repeated without increasing y values and in a periodical form.
But without a physical model and extrapolation is not meaningful. An example:
回答(2 个)
Steven Lord
2022-11-8
"In the space of one hundred and seventy-six years the Lower Mississippi has shortened itself two hundred and forty-two miles. That is an average of a trifle over one mile and a third per year. Therefore, any calm person, who is not blind or idiotic, can see that in the Old Oolitic Silurian Period, just a million years ago next November, the Lower Mississippi River was upwards of one million three hundred thousand miles long, and stuck out over the Gulf of Mexico like a fishing-rod. And by the same token any person can see that seven hundred and forty-two years from now the lower Mississippi will be only a mile and three-quarters long."
As an example of this in MATLAB, if we take a look at the standard census data set:
load census
plot(cdate, pop, '-o')
title('Population of the United States from census data')
What was the population of the United States back in the year 1492 at the time of Christopher Columbus's first voyage to North America?
interp1(cdate, pop, 1492, 'spline', 'extrap')
That doesn't look right. How about if we choose a different type of interpolation?
interp1(cdate, pop, 1492, 'linear', 'extrap')
That's not good either.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!