How to find slope of discrete point

angleslopevector analysis

I am wondering if it is possible to find the slope at each point in the following dataset,


% X Y
%===================
0.7761 0.5715
0.794 0.5729
0.8117 0.5744
0.8292 0.5762
0.8465 0.5782
0.8637 0.5804
0.8807 0.5828
0.8977 0.5853
0.9144 0.5879
0.9311 0.5907
0.9477 0.5937
0.9641 0.5968
0.9805 0.6
0.9967 0.6033
1.0129 0.6067

I understand that the slope can be obtained using the difference of the two neighboring points by

$$m = \frac{y_2-y_1}{x_2-x_1}$$

and, the angle that each point made with the $x$-axis is essentially the $atan$ of $m$

$$\theta = \tan^{-1}(m) $$

But, is it possible to calculate the slope without using the above formula? without trying to curve-fit the points.

Best Answer

In my experience, when trying to estimate the slope at a point, it is better to use the slope of the line between the preceding and following point.

This is analogous to the fact that $f'(x)$ is more accurately estimated by $(f(x+h)-f(x-h))/(2h)$ (error of order $h^2$) than by $(f(x+h)-f(x))/(h)$ (error of order $h$).