Re: restricting interpolating functions to be positive
- To: mathgroup at smc.vnet.net
- Subject: [mg106437] Re: [mg106402] restricting interpolating functions to be positive
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Tue, 12 Jan 2010 04:51:11 -0500 (EST)
- References: <201001112352.SAA20983@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
Here's a method, but it will have sharp corners for some data:
data = Sort@RandomReal[{0, 1}, {10, 2}];
{min, max} = data[[{1, -1}, 1]];
Clear[f, g]
g = Interpolation[data];
f[x_] := Max[0, g@x]
Plot[f@x, {x, min, max}, PlotRange -> All]
Bobby
On Mon, 11 Jan 2010 17:52:33 -0600, dantimatter <google at dantimatter.com>
wrote:
> Hi All,
>
> I would like to construct an interpolation that can only take on
> positive values. The data that I'm trying to interpolate is all
> positive, but for some reason the Interpolation[] function 'wants' to
> connect the dots by dipping below zero. Is there a way to force
> positivity? Or should I simply adjust the InterpolationOrder until it
> works?
>
> Thanks,
> Dan
>
--
DrMajorBob at yahoo.com
- References:
- restricting interpolating functions to be positive
- From: dantimatter <google@dantimatter.com>
- restricting interpolating functions to be positive