From: Roger Stafford on
TideMan <mulgor(a)gmail.com> wrote in message <c29d4c47-5dad-44ea-879c-f3e5c682148d(a)o8g2000yqo.googlegroups.com>...
> But Roger, doesn't your fancy algorithm reduce to central finite
> differences if the x are equispaced:
> dydx(2:end-1)=(y(3:end) - y(1:end-2))/(2*dx);
> without the pretty stuff at the ends of course.

Yes, of course, for equally-spaced x values. In that case one can obtain the same answers from the single-dimensional version of the 'gradient' function except for the endpoints, which are not properly done in my opinion.

For variable-spaced x's the 'gradient' function does not use weighted averages, so it is not actually a second order approximation in that circumstance. That is, it does not get exact derivatives for quadratic functions if the x intervals are variable - at least not in my version.

Roger Stafford
From: Beaver on
Thanks, its works perfectly

By the way is it formula has a name or something. I have to mark this to my work.

Marden
From: Bruno Luong on
Beaver <marden.nomm(a)gmail.com> wrote in message <182806353.128131.1273733858816.JavaMail.root(a)gallium.mathforum.org>...
> Thanks, its works perfectly
>
> By the way is it formula has a name or something. I have to mark this to my work.
>

Savitzky-Golay filter.

http://www.mathworks.com/access/helpdesk/help/toolbox/signal/sgolay.html

Bruno
From: Roger Stafford on
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hsg93c$kkk$1(a)fred.mathworks.com>...
> Beaver <marden.nomm(a)gmail.com> wrote in message <182806353.128131.1273733858816.JavaMail.root(a)gallium.mathforum.org>...
> > Thanks, its works perfectly
> > By the way is it formula has a name or something. I have to mark this to my work.
> > Marden
>
> Savitzky-Golay filter.
> http://www.mathworks.com/access/helpdesk/help/toolbox/signal/sgolay.html
> Bruno

To Bruno:

It would only be considered a Savitzky-Golay filter if the x-coordinates of the data were equally-spaced. However, the whole point of my suggestion was to handle the case of unequally-spaced points.

http://en.wikipedia.org/wiki/Numerical_smoothing_and_differentiation
http://en.wikipedia.org/wiki/Savitzky&#8211;Golay_smoothing_filter

To Marden:

This formula can be derived directly from Lagrange's interpolation formula for three points by evaluating the derivative at the central point.

Roger Stafford
From: Bruno Luong on
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <hsgls4$7gh$1(a)fred.mathworks.com>...
>
>
> This formula can be derived directly from Lagrange's interpolation formula for three points by evaluating the derivative at the central point.

Roger, do you have any idea about the robustness of such method when the point abscissa get closer? It's surely not good, but is it more or less robust than the diff command (order=1)? Or more generally what happens when the polynomial order increases?

Bruno