plotting the derivative of a splined/interpolated function
- To: mathgroup at smc.vnet.net
- Subject: [mg50682] plotting the derivative of a splined/interpolated function
- From: atjurhs at 3drc.com (Todd Jurhs)
- Date: Fri, 17 Sep 2004 01:15:46 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I'm attempting to read in a time ordered data file, create eiteher a
splined or interpolated data function, take the derivative of the
splined or interpolated function, and plot the resulting velocity
curve.
Here's what I've done:
Reading the Data:
dat2=Import["Documents/Rocketry_Files/MAWD_Flight_Data/bttb_i285r-2.txt","Table"]
Using Interpolating Funtions:
approx=Interpolation[dat2, InterpolationOrder\[Rule]5]
InterpolatingFunction[{{0.,91.}},<>]
checking that it works:
approx[t]/.{t->11.2}
3993.
and plotting the position curve:
Plot[approx[t],{t,0,91}]
I get a nice plot :)
Doing the same thing with the SplineFit function:
<<NumericalMath`SplineFit`
approx2 = SplineFit[dat2, Cubic]
SplineFunction[Cubic, {0., 1820.}, <>]
checking that it works:
approx2[11.2]
{0.56,128.802}
ParametricPlot[approx2[t], {t, 0, 1820},
PlotRange -> All, Compiled -> False]
Again I get a nice plot :)
Taking the derrivative of either the splined or interpolated functions
also seems to work:
dervie[t]=D[approx[t],t]
InterpolatingFunction[{{0.,91.}},<>][t]
dervie[t]/.{t->10.}
220.
AND
dervie2=D[approx2[t],t]
(SplineFunction[Cubic, {0., 1820.}, <>])'[t]
BUT I can't seem to plot either dervie or dervie2 with the standard
Plot ParametricPlot commands
So the question becomes is, how to I plot the derrivative of an
interpolated or slpined function?
Thanks for your help!