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, based on the selected approximation method. The block also allows you to implement sine and cosine functions using optimized computations according to the target hardware, without the need to specify the approximation method.
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. |
If you choose the optimization option, the block selects an optimized approximation method for the hardware board that you select in the Hardware Implementation tab of the Configuration Parameters dialog box 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 (TI) 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.
Use Optimization
For the option Optimized for selected angle units and data
type, the block applies the approximation method based on the values
specified for target platform, Theta data type, and Theta
units, as shown in this table:
| Required input | Approximation method applied | ||
|---|---|---|---|
| Target platform (based on selection for the Hardware board parameter) | Theta data type | Theta units | |
| Texas Instruments (TI) | Floating point | Rad / Per-unit / Deg | None |
| Fixed-point | Per-unit | TI IQMATH | |
| STM32TM | Floating point | Rad / Per-unit / Deg | None |
| Fixed-point | Rad / Per-unit / Deg | Lookup | |
| ARM® Cortex® | Floating point | Rad / Per-unit / Deg | None |
| Fixed-point | Rad / Per-unit / Deg | Lookup | |
| Other targets | Floating point | Rad / Per-unit / Deg | Lookup |
| Fixed-point | Rad / Per-unit / Deg | Lookup | |
For the option Best possible optimization, the block applies
the approximation method, theta data type, and theta units, based on the target platform, as
shown this table:
| Required input | Read-only parameters that are applied | ||
|---|---|---|---|
| Target platform (based on selection for the Hardware board parameter) | Approximation method | Theta data type | Theta input |
| TI | None | Floating point | Rad / Per-unit / Deg |
| STM32 | None | Floating point | Rad / Per-unit / Deg |
| ARM Cortex | None | Floating point | Rad / Per-unit / Deg |
| Others | Lookup | Floating point or Fixed-point | Rad / Per-unit / Deg |
Examples
Ports
Input
Output
Parameters
More About
Extended Capabilities
Version History
Introduced in R2024b



