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.
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 some 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  An error appears. 
Generated code  Undefined behavior occurs. Avoid relying on undefined behavior for generated code or accelerator modes. 
Accelerator modes 
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, JE. “The CORDIC Trigonometric Computing Technique.” IRE Transactions on Electronic Computers EC8 (1959); 330–334.
[2] Andraka, R. “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.” HewlettPackard Company, Palo Alto. Spring Joint Computer Conference (1971): 379–386. (from the collection of the Computer History Museum). www.computer.org/csdl/proceedings/afips/1971/5077/00/50770379.pdf
[4] Schelin, Charles W. “Calculator Function Approximation.” The American Mathematical Monthly 90, no. 5 (1983): 317–325.