I have a data logger that is recording the temperature readings from thermocouples at a specific interval. This gives me data points that I can graph where the x-coordinate is time and the y-coordinate is temperature. For each set of data points that I graph, I can connect the points and make a line - usually curved. I need to find the derivative of each line and graph those as well. There is no known function that creates these curves, so I can't simply find the derivative of a function. All I have is a huge list of (x,y) coordinates. How do I take a derivative and graph it in this case?
|
You can connect consecutive points with lines and assume that the derivative is the slope of these lines between these points. Of course, this makes the derivative noncontinuous (and not defined at the sample points). A more elaborate idea would be to go for a spline interpolation, which would give a smoothe derivative |
|||
|
|
There are several ways to get estimates of the derivative at the $i$-th point. The simplest estimate is probably $(y_{i+1} - y_{i-1})/(x_{i+1} - x_{i-1})$. This is just the slope of the line between the $(i-1)$-th point and the the $(i+1)$-th point. You'll have to do something special at the first and last points, of course. For example, at the first point, use $(y_2 - y_1)/(x_2 - x_1)$, instead. A slightly more sophisticated approach is to estimate the derivative at the $i$-th point by using the slope of the parabola passing through points $i-1$, $i$, and $i+1$. If this approach sounds attractive, and you need help figuring out the formula for this slope, feel free to ask again. Edit: I just realized that the slope of the parabola is actually given by the formula above if the $x$-values are equally spaced. So, in this case, my two suggested solutions are actually one and the same. Here are some graphs made using the first technique. The red curve shows function values, and the blue curve shows (estimated) derivative values:
|
|||||
|

