lettura simple

Trigonometric Functions in Matlab

We're going to discuss how to calculate trigonometric functions in Matlab.

Now, trigonometric functions, they're functions of an angle, expressed in radians, mind you. And we have the sine, cosine, tangent, and cotangent functions, all depending on this angle. Take note, if you will, that an angle of 90 degrees is equivalent to π/2 radians, and a full angle of 360 degrees is equal to 2π radians. The inverse functions, these are the arcsine, arccosine, arctangent, and arccotangent, and they all take the sine, cosine, tangent, and cotangent values as their arguments, respectively.

So, without further ado, let me present to you the main trigonometric functions that you can use in Matlab.

Sine

To calculate the sine of an angle x, use the sin(x) function.

>> sin(pi/4)
ans = 0.7071

Arcsine

The inverse function of the sine is the arcsine.

To calculate it, use the asin(y) function.

>> asin(0.7071)
ans = 0.7854

The arcsine function outputs the angle in radians that determines the value of sine. In this case, the angle that generates a sine value of 0.7071 is an angle of π/4 radians.

$$ \frac{\pi}{4} \ rad = 0.7854 \ rad $$

Cosine

To calculate the cosine of an angle x, use the cos(x) function.

>> cos(pi/3)
ans = 0.5000

Arccosine

The inverse function of the cosine is the arccosine acos(y).

>> acos(0.5)
ans = 1.0472

In this case, the arcsine function outputs the angle in radians (1.0472 radians) that generates a cosine value of 0.5.

$$ \frac{\pi}{3} \ rad = 1.0472 \ rad $$

Tangent

To calculate the tangent of an angle x, use the tan(x) function.

>> tan(pi/4)
ans = 1.0000

Arctangent

The inverse function of the tangent is the arctangent atan(y).

>> atan(1)
ans = 0.7854

In this example, the arctangent function outputs the angle 0.7854 expressed in radians that determines a tangent value of 1.

$$ \frac{\pi}{4} \ rad = 0.7854 \ rad $$

Cotangent

To calculate the cotangent of an angle x, use the cot(x) function.

>> cot(pi/4)
ans = 1.000

Arccotangent

The inverse function of the cotangent is the arccotangent acot(y).

>> acot(1)
ans = 0.7854

In this case, the arccotangent function outputs the angle in radians (0.7854 radians) that generates a cotangent value of 1.

$$ \frac{\pi}{4} \ rad = 0.7854 \ rad $$

Secant

To calculate the secant of an angle x, use the sec(x) function.

>> sec(0)
ans = 1

Arcsecant

The inverse function of the secant is the arcsecant asec(y).

>> asec(1)
ans = 0

The arcsecant function outputs the angle in radians (0 radians) that determines a secant value of 1.

Cosecant

To calculate the cosecant of an angle x, use the csc(x) function.

>> csc(0.5)
ans = 2.0858

Arccosecant

The inverse function of the cosecant is the arccosecant, acsc(y).

>> acsc(2.0858)
ans = 0.5000

The arccosecant function outputs the angle in radians (0.5 rad) that determines the value of 2.0858 for the cosecant.




Report a mistake or post a question




FacebookTwitterLinkedinLinkedin