Problem
I have a set of points like the ones shown on the right hand side of the image. So for each 'Ships Head' there is a corresponding value for 'Deviation'. In this example we can treat west as negative and east as positive values.
On the left of the image there is a graph made from the points on the right. What I need to do is find a way of using a setup like this to work out the deviation for any given point on the graph. So for example, given the value of 10 degrees, we should be able to calculate the deviation as something around 3.8 degrees.
Obviously its easy to manually draw a graph and then read off values however I need a way of doing this in code. I have never had to solve a problem like this before and I don't know where to start. I was thinking I could make use of trigonometry and maybe some sort of cosine wave but i don't know how to do this.
What is the way of calculating the deviation for a given degree value based on the values on the right hand side of the image?