MathGroup Archive 2006

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

Search the Archive

Re: Reconstructing data points from a InterpolatingFunction object

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66506] Re: Reconstructing data points from a InterpolatingFunction object
  • From: bghiggins at ucdavis.edu
  • Date: Wed, 17 May 2006 03:30:00 -0400 (EDT)
  • References: <e4bits$1a9$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Eckhard,

You can use the DifferentialEquations`InterpolatingFunctionAnatomy` in
Mathematica 5.2. This package does not appear under standard packages
as it likely to change in future versions. It is located in
AddOns/ExtraPackages/DifferentialEquations. The tools in this package
allow one to maniputate data in InterpolationFunctions.

<< DifferentialEquations`InterpolatingFunctionAnatomy`

Consider the following ODE:

ifun = First[x /. NDSolve[{x'[t] == x[t]Cos[t], x[0] == 1}, x, {t, 0,
10}]]

Here ifun is the InterpolationFunction returned by NDSolve. The
functions you want to use are InterpolatingFunctionCoordinates and
InterpolatingFunctionValuesOnGrid. So, for eaxmple, if you want to plot
the discrete data you can proceed as follows:

tvalues=Flatten[InterpolatingFunctionCoordinates[ifun]];
xvalues=InterpolatingFunctionValuesOnGrid[ifun];
ListPlot[Transpose[{tvalues,xvalues}]]

Hope this helps,
Cheers,
Brian


  • Prev by Date: Re: Lists and rules
  • Next by Date: Re: Lists and rules
  • Previous by thread: Re: Reconstructing data points from a InterpolatingFunction object
  • Next by thread: Re: Reconstructing data points from a InterpolatingFunction object