Specified trigonometric function on input
Simulink / Math Operations
HDL Coder / Math Operations
The Trigonometric Function block performs common trigonometric functions and outputs the result in rad or rev.
You can select one of these functions from the Function parameter list.
Function  Description  Mathematical Expression  MATLAB^{®} Equivalent 

sin
 Sine of the input 

sin

cos
 Cosine of the input 

cos

tan
 Tangent of the input 

tan

asin
 Inverse sine of the input 

asin

acos
 Inverse cosine of the input 

acos

atan
 Inverse tangent of the input 

atan

atan2
 Fourquadrant inverse tangent of the input 

atan2

sinh
 Hyperbolic sine of the input 

sinh

cosh
 Hyperbolic cosine of the input 

cosh

tanh
 Hyperbolic tangent of the input 

tanh

asinh
 Inverse hyperbolic sine of the input 

asinh

acosh
 Inverse hyperbolic cosine of the input 

acosh

atanh
 Inverse hyperbolic tangent of the input 

atanh

sincos
 Sine of the input; cosine of the input  —  — 
cos + jsin
 Complex exponential of the input  —  — 
If you use the CORDIC approximation method (see More About), the block input has further requirements.
When you set Function to sin
, cos
,
sincos
, or cos + jsin
and set the
Approximation method to CORDIC
, the
block has these limitations:
When you use signed fixedpoint types, the input angle must fall within the range [–2π, 2π) rad.
When you use unsigned fixedpoint types, the input angle must fall within the range [0, 2π) rad.
When you set Function to atan2
and the Approximation method to CORDIC
, the block has these limitations:
Inputs must be the same size, or at least one value must be a scalar value.
Both inputs must have the same data type.
When you use signed fixedpoint types, the word length must be 126
or less.
When you use unsigned fixedpoint types, the word length must be 125
or less.
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. 
When you set Function to sin
,
cos
, sincos
, or cos +
jsin
and set the Approximation method to
Lookup
, the block has these limitations:
When you use signed fixedpoint types, the input angle must fall within the range [2ᴨ,2ᴨ] rad.
When you use unsigned fixedpoint types, the input angle must fall within the range [0,2ᴨ) rad.
When you set Function to atan2
and the Approximation method to Lookup
, the block has these limitations:
Inputs must be the same size, or at least one value must be a scalar value.
Both inputs must have the same data type.
The number of data points are limited by:
smallEnoughNumDataPoints =
2^{(inputFractionLen2)}+1
bigEnoughFractionLen =
log2(numberOfDataPoints 
1)+2
where:
smallEnoughNumDataPoints is the maximum number of data points represented by specified input fraction length, inputFractionLen.
bigEnoughFractionLen is the minimum fraction length needed to represent specified number of data points, numberOfDataPoints.
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

^{[a]} This block supports fixedpoint and base integer data types for 'Approximation method' CORDIC. 
[1] Volder, Jack E., “The CORDIC Trigonometric Computing Technique.” IRE Transactions on Electronic Computers EC8 (1959); 330–334.
[2] Andraka, Ray “A Survey of CORDIC Algorithm for FPGA Based Computers.” Proceedings of the 1998 ACM/SIGDA Sixth International Symposium on Field Programmable Gate Arrays. Feb. 22–24 (1998): 191–200.
[3] Walther, J.S., “A Unified Algorithm for Elementary Functions,” Proceedings of the Spring Joint Computer Conference, May 1820, 1971: 379–386.
[4] Schelin, Charles W., “Calculator Function Approximation,” The American Mathematical Monthly 90, no. 5 (1983): 317–325.
cordiccos
(FixedPoint Designer)  cordicsin
(FixedPoint Designer)  cordicsincos
(FixedPoint Designer)