Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Interpolation difficulty

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116588] Re: Interpolation difficulty
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Mon, 21 Feb 2011 04:19:57 -0500 (EST)
  • References: <ijo544$lep$1@smc.vnet.net>

On Feb 19, 2:13 am, Javier <mathquesti... at gmail.com> wrote:
> Interpolation[{{2, 1}, {4, 5}, {5, 2}}, InterpolationOrder -> 0]
> gives a function which is 5 from 2 to 4, and 2 from 4 to 5.
>
> I want as a result a function which is 1 from 2 up to 4, then
> 5 from 4 up to 5. It should extrapolate to x=1 giving also 1,
> and to x=6 giving 2. Is this possible? Many thanks in advance.

Sorry, but I forgot to include the answer to your question.

f[x_] := Piecewise[{{1, 1 <= x < 4},
                    {5, 4 <= x < 5},
                    {2, 5 <= x < 6}}]


  • Prev by Date: Re: Cloud Mathematica
  • Next by Date: Factor/Simplify complex expressions
  • Previous by thread: Re: Interpolation difficulty
  • Next by thread: weibull plot on weibull scaled paper