how to interpolate outside the domain of x?

10 views (last 30 days)
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 Comment
Jan
Jan on 8 Nov 2022
Edited: Jan on 8 Nov 2022
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:
  • 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?

Sign in to comment.

Answers (2)

Steven Lord
Steven Lord on 8 Nov 2022
From Mark Twain's "Life on the Mississippi", a quote on the potential danger of extrapolation.
"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')
ans = 900.3989
That doesn't look right. How about if we choose a different type of interpolation?
interp1(cdate, pop, 1492, 'linear', 'extrap')
ans = -37.8200
That's not good either.

Image Analyst
Image Analyst on 8 Nov 2022
If you want to fit an exponential, see the attached demo.

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!