Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Let's say I have an "S" shaped curve made up of 50 points. I am only given the data points, and there is no simple or obvious equation for each point on the curve.

So given only the data points, how would I be able to calculate the slope of the curve at a particular data point?

share|improve this question
add comment

3 Answers

Estimate the tangent by taking the secants you can compute; you the tangent will lie somewhere between the two.

That is: you cannot compute the slope exactly, but you can estimate it from the information you have.

You have immediately preceding and immediately succeeding points, $t_{i-1}$ and $t_{i+1}$, as well as value $f(t_{i-1})$, $f(t_i)$, and $f(t_{i+1})$. The secant between $(t_{i-1},f(t_{i-1}))$, and $(t_i,f(t_i))$ has a certain slope $L_1$; the secant between $(t_i,f(t_i))$ and $(t_{i+1},f(t_{i+1}))$ has a certain slope $L_2$. Unless the graph is very nasty, the tangent at $(t_i,f(t_i))$ should have a slope that is somewhere between $L_1$ and $L_2$.

share|improve this answer
add comment

The simplest is just to take one of the neighboring points and find the slope of the line through those two. This approach is sensitive to measurement error in the points, particularly if they are measured at x values that are close together. Another approach is to fit some functional form (like an arctangent or logistic function is your data is S shaped) through the data points. This is smoothing, so will be less sensitive to measurement error (particularly if it has fewer parameters than you have measurements), but is sensitive to modeling error. There is a discussion in chapters 3 and 15 of Numerical Recipes

share|improve this answer
add comment

Cubic Splines! You fit cubic spline through the points, and then take slope from the cubic spline definition. Note that if the data have any noise, you need to smooth it first.

links

  1. Cubic Splines - Wolfram
  2. Splines - Wikipedia
  3. Interpolation - Numerical Recipies Online - Open charter B3

Once the spline is defined, for each segment with curve coordinates ($x(\alpha)$,$y(\alpha)$) the slope is $$s=\frac{\mathrm{d}y/\mathrm{d}\alpha}{\mathrm{d}x/\mathrm{d}\alpha}$$ evaluated at the desired location parameter $\alpha=0\ldots1$.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.