Open In App

Trigonometric Functions in MATLAB

Last Updated : 30 May, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

In this article, we are going to discuss trigonometric functions and their types in MATLAB. Trigonometric functions are the mathematical functions that can result in the output with the given input. 

There are six trigonometric functions –

  1. Sine (sin)
  2. Cosine(cos)
  3. Tangent(tan)
  4. CoTangent(cot)
  5. Secant(sec)
  6. CoSecant(csc)

Sine Function

  • sin: Sin function returns the sine of input in radians. The input can be a number or an array or a matrix.

Syntax: sin(value)

  • sind: This function returns the sine of input in degrees.

Syntax: sind(value)

  • asin: This function returns the inverse of sine in radians.

Syntax: asin(x)

  • asind: This function returns the inverse of sine in degrees.

Syntax: asind(x)

  • sinh: This function returns the hyperbolic sine of the value.

Syntax: sinh(x)

  • asinh: This function returns the inverse hyperbolic sine of the value.

Syntax: asinh(x)

Example:

Matlab




% input value is x which is initialized
% as 34
x=34
  
% compute sin(x)
sin(x)
  
% compute sind(x)
sind(x)
  
% compute asin(x)
asin(x)
  
% compute asind(x)
asind(x)
  
% compute sinh(x)
sinh(x)
  
% compute asinh(x)
asinh(x)


Output:

Cosine Function

  • cos: cos function returns the cosine of input in radians. The input can be a number or an array or a matrix,

Syntax: cos(value)

where value is the input value.

  • cosd: This function returns the cosine of input in degrees.

Syntax: cosd(value)

  • acos: This function returns the inverse of cosine in radians

Syntax: acos(x)

  • acosd: This function returns the inverse of cosine in degrees.

Syntax: acosd(x)

  • cosh: This function returns the hyperbolic cosine of the value.

Syntax: cosh(x)

  • acosh: This function returns the inverse hyperbolic cosine of the value.

Syntax: acosh(x)

Example:

Matlab




% input value is x which is initialized as 58
x=58
  
% compute cos(x)
cos(x)
  
% compute cosd(x)
cosd(x)
  
% compute acos(x)
acos(x)
  
% compute acosd(x)
acosd(x)
  
% compute cosh(x)
cosh(x)
  
% compute acosh(x)
acosh(x)


Tangent Function

  • tan: tan function returns the tangent of input in radians. The input can be a number or an array or a matrix,

Syntax: tan(value)

where value is the input value

  • tand: This function returns the tangent of input in degrees.

Syntax: tand(value)

  • atan: This function returns the inverse of tangent in radians

Syntax: atan(x)

  • atand: This function returns the inverse of tangent in degrees.

Syntax: atand(x)

  • tanh: This function returns the hyperbolic tangent of the value.

Syntax: tanh(x)

  • atanh: This function returns the inverse hyperbolic tangent of the value.

Syntax: atanh(x)

Example:

Matlab




% input value is x which is initialized as 68
x=68
  
% compute tan(x)
tan(x)
  
% compute tand(x)
tand(x)
  
% compute atan(x)
atan(x)
  
% compute atand(x)
atand(x)
  
% compute tanh(x)
tanh(x)
  
% compute atanh(x)
atanh(x)


Cotangent Function

  • cot: cot function returns the cotangent of input in radians. The input can be a number or an array or a matrix,

Syntax: cot(value)

where value is the input value

  • cotd: This function returns the co-tangent of input in degrees.

Syntax: cotd(value)

  • acot: This function returns the inverse of co- tangent in radians

Syntax: acot(x)

  • acotd: This function returns the inverse of co-tangent in degrees.

Syntax: acotd(x)

  • coth: This function returns the hyperbolic co- tangent of the value

Syntax: coth(x)

  • acoth: This function returns the inverse  hyperbolic co-tangent of the value

Syntax: acoth(x)

Example:

Matlab




% input value is x which is initialized as 45
x=45
  
% compute cot(x)
cot(x)
  
% compute cotd(x)
cotd(x)
  
% compute acot(x)
acot(x)
  
% compute acotd(x)
acotd(x)
  
% compute coth(x)
coth(x)
  
% compute acoth(x)
acoth(x)


Secant Function

  • sec: sec function returns the secant of input in radians. The input can be a number or an array or a matrix,

Syntax: sec(value)

where value is the input value

  • secd: This function returns the secant of input in degrees.

Syntax: secd(value)

  • asec: This function returns the inverse of secant in radians.

Syntax: asec(x)

  • asecd: This function returns the inverse of secant in degrees.

Syntax: asecd(x)

  • sech: This function returns the hyperbolic secant of the value

Syntax: sech(x)

  • asech: This function returns the inverse  hyperbolic secant of the value

Syntax: asech(x)

 Example:

Matlab




% input value is x which is initialized as 89
x = 89
  
% compute sec(x)
sec(x)
  
% compute secd(x)
secd(x)
  
% compute asec(x)
asec(x)
  
% compute asecd(x)
asecd(x)
  
% compute sech(x)
sech(x)
  
% compute asech(x)
asech(x)


CoSecant Function

  • csc: csc function returns the co-secant of input in radians. The input can be a number or an array or a matrix,

Syntax: csc(value)

 where value is the input value

  • cscd: This function returns the co-secant of input in degrees.

Syntax: cscd(value)

  • acsc: This function returns the inverse of co- secant in radians.

Syntax: acsc(x)

  • acscd: This function returns the inverse of co-secant in degrees.

Syntax: acscd(x)

  • csch: This function returns the hyperbolic co-secant of the value.

Syntax: csch(x)

  • acsch: This function returns the inverse hyperbolic co-secant of the value.

Syntax: acsch(x)

Matlab




% input value is x which is initialized as 13
x = 13
  
% compute csc(x)
csc(x)
  
% compute cscd(x)
cscd(x)
  
% compute acsc(x)
acsc(x)
  
% compute acscd(x)
acscd(x)
  
% compute csch(x)
csch(x)
  
% compute acsch(x)
acsch(x)




Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads