How do I find the angle in relation to a horizontal line?

158 Views Asked by At

Assuming I have a string of numbers as follow:

  1. $x_1 = 112.26$
  2. $x_2 = 111.9419999$
  3. $x_3 = 111.4540002$
  4. $111.0100004$
  5. $110.5565004$
  6. $110.2940004$
  7. $109.8075006$
  8. $109.3955007$
  9. $108.7385004$

How do I find the angle of the curve in relation to an horizontal line at point $x_2$? See image

Thanks

1

There are 1 best solutions below

0
On

You have that all the line segment that link two points are the hypotenuses of right triangles that have as catheti the difference $y_i-y_j$ (calling with $y$ the position of the number in the string) and the $x_i-x_j$ (the values corresponding to $y_i$ anda $y_j$).

You know that $\tan\theta$ is equal to $\frac{\Delta x}{\Delta y}$.

So the angle in relation to the horizontal line $x=x_2$ will be for the segment thet goes from $x_1$ to $x_2$ $\theta_1=\arctan (\frac{x_1-x_2}{1})$ and for the segment that goes form $x_2$ to $x_3$ will be $\theta_2=\arctan(\frac{x_2-x_3}{1})$.