Matt Kornblum EDN The circuit in Figure 1 converts a ±10 V analog voltage representing an angle between θ_{MIN }and θ_{MAX} and emits a voltage equal to 10·cosθ. This circuit can have an accuracy of better than 1% over ±120° or better than 0.2% over ±90°. These figures represent an orderofmagnitude improvement over a Taylorseries estimate for the same range and for the same number of multiplications. The Taylorseries definition for a cosine (with θ in radians) is:
The series works well for high values of n or small angles. Generally, for n = 2, significant errors start to accumulate for angles exceeding ±45°. When you use a Taylorseries expansion for better accuracies at larger angles, the number n becomes larger and demands more resources from the design. The Taylor series for n = 2 has the form of where a = 1, b = 0.5, and c = 0.041667 (for angles in radians). By using a leastsquares curve fit to optimize this function at n = 2, you can find coefficients that allow you to obtain significantly better accuracies over the desired input range without raising the value of n to more than 2. The circuit in Figure 1 embodies this leastsquares approach.
Choosing the resistor values for the circuit is relatively simple. Set R_{1} and R_{2 }equal to each other (for 10 V maximum input and a ≈ 1), and determine values for R_{2} and R_{4} by applying the following equations: and IC_{1} generates the square of V_{IN} and negates it. This output sums through R_{2} into IC_{3}. IC_{2} generates the fourth power of V_{IN} and sums it into IC_{3 }through R_{4}. A –10 V reference across R_{1 }creates the "a"coefficient constant current into IC_{3}. The output of IC_{3} is the sum of the three terms. Because IC_{1} is an inverting amplifier, the circuit configures the multipliers such that the output of IC_{1} is positive and the output of IC_{2} is negative. Choosing the proper 0.1% resistors can improve circuit accuracy to better than 1% for –120° to +120°. You should use a lowoffset op amp for best results. Figure 2 shows the Taylorseries error, the theoretical fit, and the actual fit. For a fit in a 90° range, the values change slightly, and the errors across the range become significantly smaller. The constant "a" becomes 0.9996, b=0.4962, and c=0.0371. Then, R_{1}=R_{3}=10 kΩ, R_{2}=8.16 kΩ, and R_{4}=44.2 kΩ.
You can use the same approach to efficiently calculate cosine and sine values in a DSP system more rapidly than using a lookup table. Materials on the topicInside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFVMw


