Re: Step functions
- To: mathgroup at smc.vnet.net
- Subject: [mg17071] Re: Step functions
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 23 Apr 1999 02:32:10 -0400
- Organization: Universitaet Leipzig
- References: <7f9g05$52i@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Alessio,
the most elegant version is
f=Interpolation[{{0,1},{1,2},{2,1.5},{3,2.5}},InterpolationOrder->0]
Hope that helps
Jens
Alessio Massaro wrote:
>
> Can anyone help me to build a step function out of a series of {x,y} pairs?
>
> For ex.., consider an ordered random {x,y} series like
>
> data=Sort[Table[{Random[],Random[]}, {10}], First[#1]<First[#2]&]
>
> I would like to build a function f[ { {x1, y1}, {x2, y2}, ...}, x ], that
> evaluates to:
> Thanks and regards to everybody
> Alessio