Question:
How do you differentiate a raw data set in Matlab without having to use a spline?
Physics_Student
2010-01-31 18:51:49 UTC
Does anyone know how to differentiate a data set in Matlab? In other words, if you are given a set of x-values with their corresponding y-values how can you differentiate this data set?

I don't mean running a spline through the data then differentiating the spline. I'm trying to find out how to differentiate a raw data set. Any help would be greatly appreciated.
Four answers:
Cody
2010-02-03 06:52:40 UTC
You cant differentiate a raw data set, its mathematically impossible. You have to fit a curve to the data or use a tangent approximation. For example, put a loop in the code that will find the secant line between point i and i+2, then use this as the approximation of the tangent (aka derivative) at at point i+1. Repeat this for the entire data set. The more data points you have, the more accurate this will be, of course.
anonymous
2016-11-08 02:05:09 UTC
Differentiate Matlab
Paul
2010-02-01 20:11:55 UTC
just make a loop which, for each point, calculates the slope at that point. the derivative is just the slope at a given point. for example



for i=1:length(x)-1

deriv(i)=(x(i+1)-x(i))/(y(i+1)-y(i))

end



this isn't technically 100% correct because you are really calculating the slope in the center of the segment between i and i+1. you could correct this if you want to get fancy
anonymous
2016-03-14 14:09:34 UTC
No,he did not.If he really did ruptured his spline,he couldn't even walk.No matter how tough you are,you can't walk with a ruptured spline.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...