Re: Experimental data as function?
- To: mathgroup at smc.vnet.net
- Subject: [mg25766] Re: Experimental data as function?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sat, 21 Oct 2000 18:33:01 -0400 (EDT)
- References: <8ssqbe$19n@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Eric,
Make an interpolating function:
data = Table[{x, Sin[x]}, {x, 0, 2Pi, Pi/50}];
sin = Interpolation[data]
InterpolatingFunction[{{0, 2 Pi}}, <>]
NIntegrate[sin[x], {x, 0, 2.57}] (*don't use Integrate*)
1.84104
NIntegrate[Sin[x], {x, 0, 2.57}]
1.84104
Plot[{sin[x], sin'[x]}, {x, 0, 2Pi}]
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Eric Sommer" <erso at hrem.mpi-stuttgart.mpg.de> wrote in message
news:8ssqbe$19n at smc.vnet.net...
> Hi,
>
> I have measured an experimental curve and the data are available as
> (x,y=f(x)) ASCII data pairs. I would like to use this curve as a
> function that I can insert, for example, in calculations, or that I can
> integrate. It should work in the way that for a given x, the measured y
> value will be taken.
> I found methods to import data as lists, but could not find any hint to
> use them as a function.
>
> Is there a possibility to create such a function with Mathematica? How
> can it be done? What will happen, e.g. for an integration, when x values
> appear that were not measured?
>
> Thank you,
> Eric Sommer
>