Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: plotting the derivative of a splined/interpolated function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50727] Re: plotting the derivative of a splined/interpolated function
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 18 Sep 2004 05:48:20 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <cidt8u$bsq$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

data = Table[{x, Sin[x]}, {x, 0, Pi, Pi/256}];
f = Interpolation[data]
Plot[{f[x], f'[x]}, {x, 0, Pi}]

but a spline ahs usual no smooth derivatives.
I also don't think that ther derivative is 
implementet for spine approximations.

Regards
  Jens



Todd Jurhs wrote:
> 
> 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!


  • Prev by Date: Re: Outline view?
  • Next by Date: Re: How to simplify to a result that is real
  • Previous by thread: plotting the derivative of a splined/interpolated function
  • Next by thread: Re: plotting the derivative of a splined/interpolated function