set of points and derivative

Hi everyone!
I have kind of a problem. I don´t know exactly how to do the first derivative of a given set of points. I have tried the command "sgolay" to creat a filter, and do the derivative with the command "dot", but it´s not as good as it should be.
Any suggestions? Thank you very much.
Juan Carlos

 Accepted Answer

David Young
David Young on 5 Apr 2011

0 votes

It's not clear to me why you'd use the DOT function in this context rather than convolution? (I know convolution is just the dot product in a loop, but this makes me wonder whether you're applying the filter correctly.) Also, "not as good as it should be" is a bit vague - how good should it be? How do you know it could be better?
Anyway, perhaps you should start with simple methods, rather than SGOLAY? A lot depends on the noise, and what you want to do about it.
If there's negligible noise, and if the data points are equally spaced in the independent variable, you can use DIFF to take successive differences. These give estimates of the first derivative, centred between the original data points (after division by the increment in the independent variable).
If the independent variable is not equally spaced, you need to use DIFF to get its increments too, and divide pointwise by them. If there's noise, you might need some smoothing - convolve with a smoothing filter.
There are also more advanced methods that fit a local model to sets of data points. It might be worth looking at them.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!