Message Boards Message Boards

3
|
1495 Views
|
2 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Adding Extrapolation feature into Interpolation function

Posted 11 months ago

Hi all,
I have created a simple Interpolation[] function and I would like to ask if it is possible to set some extrapolation method.
Thank you
Paolo

POSTED BY: Tarpanelli Paolo
2 Replies

You can set an arbitrary function to handle extrapolation:

ifn = Interpolation[Range[10]^2,
  "ExtrapolationHandler" -> {
    Piecewise[{{100 - (# - 10)^2, x >= 10}}, 1 + 10 (1 - #)] &, 
    "WarningMessage" -> False
    }]

If you want extrapolation to be undefined, do something like this:

ifn = Interpolation[Range[10]^2,
  "ExtrapolationHandler" -> {
    Indeterminate &,
    "WarningMessage" -> False
    }]

Of course, Denis's suggestions are better if you have a model for your data.

POSTED BY: Michael Rogers
Posted 11 months ago

You could try to create (from your data) the next models:
LinearModelFit
NonlinearModelFit
etc.,
they are suitable for extrapolation.
But it’s better if you post your code and sample data, then we can find a solution.

POSTED BY: Denis Ivanov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract