Is it possible to extrapolate for a multidimensional problem in MATLAB 7.2 (R2006a)?

30 views (last 30 days)
I have a multidimensional Look-Up Table which I want to use to extrapolate values. However, I did not find a command to extrapolate in a multidimensional space and the function INTERPN only works for interpolation according to the MATLAB documentation.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 24 Apr 2013
This enhancement has been incorporated in Release 2013a (R2013a). See the documentation on INTERPN for more information on extrapolation. For previous product releases, read below for any possible workarounds:
It is possible to extrapolate values using the functions INTERP2, INTERP3 or INTERPN with the interpolation method ‘spline’.
The methods ‘nearest’, ’linear’ and ‘cubic’ will return NaNs if used for extrapolation.
The following code provides a simple example on how the multidimensional extrapolation works:
in1=[1:2];
a(:,:,1,1)=ones(2);
a(:,:,1,2)=2*ones(2);
a(:,:,2,1)=2*ones(2);
a(:,:,2,2)=4*ones(2);
testin=[10*rand(1,4)];
%interpn returns a numerical value if the method 'spline' is chosen and the
%point lies outside the range defined by the look-up table
extspl=interpn(in1,in1,in1,in1,a,...
testin(1),testin(2),testin(3),testin(4),'spline')
%interpn returns NaN if the method 'linear' is chosen and the
%point lies outside the range defined by the look-up table
extlin=interpn(in1,in1,in1,in1,a,...
testin(1),testin(2),testin(3),testin(4),'linear')
In general, the accuracy depends on the fit, the assumptions made about the model, and the problem involved.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Products


Release

R2006a

Community Treasure Hunt

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

Start Hunting!