Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Stop extrapolation outside range

384 views
Skip to first unread message

Yas

unread,
Feb 6, 2002, 3:56:36 AM2/6/02
to
Hi,
How do I go about stopping Mathematica from using extrapolation when the
specified data range falls outside the actual data range from which the
Interpolating function was generated?

e.g.
data = {{x1,y1}.......{xn,yn}};
int = Interpolate[data];
t1=Table[int[x],{x, xi, xf, dx}]

with xn != xf.

When xn != xf, Mathematica correctly points out that the point xf lies
outside the data range of the Interpolating function and proceeds to
extrapolate. How do I stop it from extrapolating.

Thanks
Yas

Jens-Peer Kuska

unread,
Feb 7, 2002, 5:19:32 AM2/7/02
to
Hi,

don't ask for values outside of the interval ?

> data = {{x1,y1}.......{xn,yn}};
> int = Interpolate[data];

> t1=Table[int[x],{x, xi, xn, dx}]
>

what else should Mathematica do ? use the periodic
values f[x1+Mod[(x-x1),(xn-x1)]]
return Infinity so that the function can't be plotted ?

Regards
Jens

Tomas Garza

unread,
Feb 7, 2002, 5:56:11 AM2/7/02
to
Define a new function, t, like this:

In[1]:=
t[x_] := int[x] /; 1 <= x <= 10;
t[x_] := 0 /; x < 1 || x > 10;

and use it instead of int. It will give you 0 whenever you're outside the
interpolation range. BTW, the name is "Interpolation", not "Interpolate".

Tomas Garza
Mexico City

0 new messages