MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Extrapolation in mathematica


Just turn off the error message. For instance:

data = Table[x + 5Random[], {x, 1, 20}];
f = Interpolation[data];
Off[InterpolatingFunction::"dmval"]
Plot[f@x, {x, 0, 21}];

Extrapolations are usually meaningless, however--as a few trials of the code will clearly demonstrate.

For instance, the following fit is lousy outside the data range:

g = 2 - x + x^2 + x^3 + x^4;
data = Table[g, {x, 1, 20}];
f = Interpolation[data, InterpolationOrder -> 3];
Plot[{g, f[x]}, {x, -5, 0}]

But changing InterpolationOrder makes it perfect:

f = Interpolation[data, InterpolationOrder -> 4];
Plot[{g, f[x]}, {x, -5, 0}]

Bobby

From: brindaban at gmail.com (nilaakash)
To: mathgroup at smc.vnet.net
Subject: [mg51549] Extrapolation in mathematica
Organization: Steven M. Christensen and Associates, Inc and MathTensor, Inc.


Dear
           Anybody could you tell me how to extrapolate data in
mathematica. I can interpolate my data, but extrapolation is not
working.

Thanks.

nilaakash




  • Prev by Date: Re: Formatting numbers for output
  • Next by Date: Re: conditionnal rule
  • Previous by thread: Re: Extrapolation in mathematica
  • Next by thread: Re: Extrapolation in mathematica