[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: diff(x) question

**From**: |
El Jeffo |

**Subject**: |
Re: diff(x) question |

**Date**: |
Tue, 19 Jan 1999 07:46:50 +0000 |

>* Diff computes forward differences. Not the derivative. If you want to*
Ah that's why I get back one less term right?
>* 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*
Um, okay is there a function that does this and returns a vector/array
for that? If not, I'm at a loss on how to do this nicely in the
future... I guess I can make my own function like
result = mydiff(x(t)) ?
do I write it like:
function mydiff(f)
{
Uh..... good grief, I can't even figure out where to start
}
I mean I can write it in C or like perl, but I dunno how to do it
in matlab or octave... is this something trivial?
Actually this is for an assignment for a class I'm taking, but they
want it in matlab. One of the problems speced that we use the diff()
function in matlab, does the octave version work the same? Otherwise,
I guess I'll go shell out the money for matlab... just trying to
see how much octave can do in place of matlab.
Hey thanks for all the help and I understand if this is asking too
much.
Jeff