From help-octave-request at bevo dot che dot wisc dot edu Tue Jan 19 03:40:07 1999 Subject: RE: diff(x) question From: Van den Eynde Gert To: help-octave at bevo dot che dot wisc dot edu Date: Tue, 19 Jan 1999 10:39:51 +0100 > Diff computes forward differences. Not the derivative. If you want to > approximate the derivative by using forward differences you have to > divide by the step h with which you make your function discrete. > In this case h = .1 > > > df f(t+h) - f(t) > -- (t) =~ --------------- + O(h) > dt h > just want to update my previous answer. I suggest to use a symmetrical formula (f(t+h) - f(t-h))/(2h) this gives an error of O(h^2) AND you can use Richardson extrapolation (extrapolation to the limit). IMHO, this is a good way to compute a numerical derivative. Gert Van den Eynde ''''' (-o-o-) _________________________.oooO--(_)--Oooo._________________________ | Gert Van den Eynde mailto:gvdeynde at sckcen dot be| | | SCK-CEN http://www.sckcen.be/people/gvdeynde | | FLINS | | Boeretang 200 | | B-2400 Mol .oooO | | Belgium ( ) Oooo. | |___________________________\ (____( )____________________________| \_) ) / (_/