SinCos Embedded Optimized
Libraries:
Motor Control Blockset /
Controls /
Math Transforms
Description
The SinCos Embedded Optimized block implements sine and cosine functions using the specified position or phase input signal.
The block supports CORDIC, TI IQMATH, and lookup-based approximation methods to compute the sine and cosine signals. The following table lists the supported data types, θe input units, as well as use cases for each approximation method.
Approximation Method | Data Types Supported | θe Input Units Supported | When to Use This Method |
---|---|---|---|
None | Floating point |
| You want to use the default Taylor series algorithm. |
CORDIC | Floating point and fixed point | Radians (-π to π) | You want a fast, approximate iterative calculation. |
Lookup | Floating point and fixed point |
| You want a fast, approximate lookup table implementation. |
Texas Instruments® IQMATH | Fixed point ( | Per-unit (0 to 1) | You cannot manually select this value. The block automatically selects this value, when you optimize the block for a Texas Instruments hardware. |
The block enables you to automatically select an optimized approximation method for the hardware board that you select in the Hardware Implementation tab of the Configuration Parameters dialog for the Simulink® model containing this block.
For example, the block automatically selects the Texas Instruments IQ math approximation method, if you select any Texas Instruments hardware target.
CORDIC Approximation Method
CORDIC is an acronym for COordinate Rotation DIgital Computer. The Givens rotation-based CORDIC algorithm is one of the most hardware-efficient algorithms available because it requires only iterative shift-add operations. For more information, see CORDIC. The block input has further requirements.
For more information about selecting the CORDIC approximation method, see Approximation method.
This table summarizes what happens for an invalid input.
Block Usage | Effect of Invalid Input |
---|---|
Simulation modes | An error appears. |
Generated code | Undefined behavior occurs. Avoid relying on undefined behavior for generated code. |
Lookup Approximation Method
The block supports the lookup table approach. This approach results in optimized code-execution when used with the model settings and configuration adopted by the examples shipped in Motor Control Blockset™. You can specify the number of lookup table points in the Number of data points for lookup table parameter.
This figure shows the input position along with the sine and cosine output signals that the block generates using the lookup approximation method:
For more information about selecting the lookup approximation method, see Approximation method.
Examples
Ports
Input
Output
Parameters
More About
Extended Capabilities
Version History
Introduced in R2024b