I need to calculate the rotation of a needle in degrees or radians from a given value, specifically vertical speed of an airplane in feets per minute. The results should be like this:
Input value $\implies$ Result
$-1500 \implies -135$
$-1000 \implies -90$
$-500 \implies -45$
$0 \implies 0$
$500 \implies 45$
$1000 \implies 90$
$1500 \implies 135$
Can you please show me a formula how to do this ? I have no idea.
From what I’ve gathered what you want you want to have a linear transformation from altitute to rotation of a needle.
In that case the formula would look somewhat like $$ y = kx + d \mod 360 $$ in degrees $$ y = kx + d \mod 2\pi $$ for rad. In your case $d=0$ and $k=45/500=9/100$.
Here the notation $A \mod B$ means $A-[A/B]B$ where $[.]$ is the flooring function.
So your formula is basically $$ y = 9/100\cdot x - [(9/100\cdot x) / 360]\cdot 360 = 9/10\cdot x - [x/4000]\cdot360 $$