For a project in my free time I am writing a formula for an autopilot system.
I need a formula that will set the deflection of a rear wing (a range between $-2$ and $2$) based on whether an object is above or below a certain altitude. As the difference between the current altitude and desired altitude gets closer to $0$, so should the deflection and as it gets further away the formula should set the deflection appropriately.
The deflection of the rear wing is the angle at which it sits in relation to the plane. A deflection of $2$ angles the wing downward and moves the plane up, increasing the vertical speed. $-2$ the opposite and will decrease the vertical speed.
If this is beyond what a noob can understand feel free to close this topic with extreme prejudice :) Any resources to get me on track will be accepted answers!
Never have taken a calc class in my life so please go easy on me. Any resources to help put an old guy on a good path to learn calc are welcomed and appreciated. Thank you!