From: spellucci@mathematik.tu-darmstadt.de (Peter Spellucci)
Subject: Re: Numerical derivatives
Date: 5 May 1999 11:54:13 GMT
Newsgroups: sci.math.num-analysis
Keywords: Computing derivatives numerically, Savitsky-Golay filters
In article <925836628.949875@aphrodites.newnetworks.it>,
"Fabio" writes:
|> Can anybody help me to find some numerical algorithm to compute numerical
|> derivatives ?
|>
|> PS: I must compute numerical derivatives to obtain velocity and acceleration
|> from numerical sample of displacement and I must do it in a real time
|> application.
|>
|>
we are time point t_i and have data u(t_i), u(t-{i-1}),......
we want u'(t_i), u''(t_i) ?
solution depends on whether t_i is equidistant or not.
in general:
take a (low order) polynomial p(t) and interpolate data
(t_j,u(t_j)), j=i,i-1,...,i-k (gives degree k (at most))
take p'(t_i) for u'(t_i) and p''(t_i) for u''(t_i).
warning: if your data are error prone, numerical derivatives may be quite
inaccurate, but in real time, no other solution than using back values is
possible.
for equidistant t_i with distance h fixed some formulae are
u'(t_i) =
(1/(6*h)) *( 11u(t_i)-18*u(T_{i-1})+9*u(t_{i-2))-2*u(t_{i-3}))
error term + O(h^3)
u''(t_i) =
(1/(12*h^2))*(35*u(t_i)-104*u(t_{i-1})+114*u(t_{i-2})-56*u(t_{i-3})
+11*u(t_{i-4}))
error term + O(h^3)
the error due to errors e_j in u(t_j) will be about
5*e_max/h and 30*e_max/h^2
hence you must optimize choosing h.
hope this helps
peter
==============================================================================
From: "Jack Silver"
Subject: Re: Numerical derivatives
Date: Thu, 6 May 1999 08:08:48 EDT
Newsgroups: sci.math.num-analysis
If the points are noisy, try a Savitzky-Golay - You can find the algorithm
in Numerical Methods. It will always be 2 points behind your data (it needs
5 points to work), and can't get started before you acquire the fifth data
point. It will smooth out noisy derivatives, but fast changes are also
smoothed out. The change will be spread over the 5 data points in a sample.
Fabio wrote in message <925836628.949875@aphrodites.newnetworks.it>...
>Can anybody help me to find some numerical algorithm to compute numerical
>derivatives ?
>
>PS: I must compute numerical derivatives to obtain velocity and acceleration
>from numerical sample of displacement and I must do it in a real time
>application.
>
>
==============================================================================
From: Thomas Kragh
Subject: Re: Numerical derivatives
Date: Fri, 07 May 1999 05:21:48 GMT
Newsgroups: sci.math.num-analysis
Fabio wrote:
> PS: I must compute numerical derivatives to obtain velocity and acceleration
>
> from numerical sample of displacement and I must do it in a real time
> application.
Do you have any idea what the noise statistics are? Any guesses / estimates /
measurements of the PSD (Power Spectrum) ?
If so, I would second the motion that you use a Kalman filter to estimate the
1st and 2nd derivative, or at the very least implement your 1st and 2nd
derivative estimators as FIR filters with a high-frequency roll-off based on
your noise spectra.
If not, then I guess you'll have to do a 1st-difference and
2nd-central-difference to the derivatives, smile, and bite the pillow.
Jack Silver wrote:
> If the points are noisy, try a Savitzky-Golay - You can find the algorithm
> in Numerical Methods. It will always be 2 points behind your data (it needs
> 5 points to work), and can't get started before you acquire the fifth data
> point. It will smooth out noisy derivatives, but fast changes are also
> smoothed out. The change will be spread over the 5 data points in a sample.
I'm not familuar with Savitzky-Golay. Is it some kind of 5-point smoother?
Fabio, if you're doing a real-time application, does this involve feedback
control? Do you have enough phase margin to handle a two-sample delay in your
velocity / acceleration measurement?
Tom Kragh
Remove obvious spam-block to reply
==============================================================================
From: Travis Oliphant
Subject: Re: Numerical derivatives
Date: Sat, 8 May 1999 16:13:10 -0500
Newsgroups: sci.math.num-analysis
I use Savitsky-Golay filters on N-D datasets all of the time to get pretty
good estimates of 2nd order derivatives on relatively noisy data. They're
just a FIR filter defined by a least squares fit to the data. You select
the window size and the order of the fitting polynomial as parameters.
==============================================================================
From: John Hernlund
Subject: Re: Complex Functions using Polar Coordinates
Date: Fri, 10 Dec 1999 13:33:02 -0700
Newsgroups: sci.math.num-analysis
To: "Franky.Backeljauw"
On 10 Dec 1999, Franky.Backeljauw wrote:
> Thanks for the information. I have a bit of knowledge concerning complex
> analysis (through my seminar-sessions) but I would like to know much more
> of the consequences of using polar coordinates per se ... I mean, is
> working with polar coordinates more sensitive to large rounding errors
> than it is with cartasian coordinates, and thus which is best ?
> How to do the operations farely accurately ?
> And what about performance-issues ?
> Franky Backeljauw franky.backeljauw@uia.ua.ac.be
Franky,
I am going to digress a little from your main question. I think one of
these coolest results of complex integration theory concerning accuracy is the
representation theorem:
the nth derivative of f(z) = n!/(2*pi*i) * INT[f(z)*dz/(z-zo)^(n+1)]
This is evaluated along a closed contour containing a region, and zo is a
point within that region. What this means is that the operation of
differentiation can be swapped for an integration (given that f(z) is
analytic). Numerically, integration is far more stable than differentiation.
Concerning polar coordinates in general, the value of |z| changes linearly out
from the origin, but the further you move out the more sensitive a point's
location will be to the value of arg(z). That is, a small error in arg(z)
close to (0,0) will have a small effect on the change in location but for
large |z| the same error makes a much larger change. So I would say that
polar results contain less room for error the closer you get to the origin,
but far away things are more hairy. The sensitivity to arg(z) is proportional
to the value of |z|...
John Hernlund
E-mail: hernlund@asu.edu
WWW: http://www.public.asu.edu/~hernlund/
******************************************************************************