Site icon TestingDocs.com

Octave Trigonometric Functions

Overview

In this tutorial, we will learn about Octave Trigonometric Functions. All the trigonometric functions are available in Octave.

Trigonometric Functions

Octave supports basic trigonometric functions like sin, cos, tan, etc.

The trigonometric functions are as follows:

 

Trigonometric Function
Description
sin(x)

 

To compute the sine of an angle, x in radians.
cos(x) To compute the cosine of an angle, x in radians.
tan(x) To compute the tangent of an angle, x in radians.
sec(x) To compute the secant of an angle, x in radians.
csc(x) To compute the cosecant of an angle, x in radians.
cot(x) To compute the cotangent of an angle, x in radians.

Examples

It is important to note that the argument for the function should be in radians.

Compute sin of 30 degrees.

>> % To calculate sin of 30 degrees
>> sin(30)
ans = -0.9880
>> % The above answer is wrong
>> sin(30*pi/180)
ans = 0.5000
>>
>>

Compute the value of 

>> sin(pi/2)
ans = 1

Compute the value of 

>> cos(pi/4)
ans = 0.70711

Compute the value of

>> tan(pi/4)
ans = 1.00000

 

Note that Octave is a case-sensitive language. The function names sin(x) and Sin(x) are different. In fact, if we haven’t defined any function with the name Sin, we would get the following function undefined error:

>> Sin(x)
error: ‘Sin’ undefined near line 1, column 1

 

Inverse Trigonometric Functions

https://www.testingdocs.com/inverse-trigonometric-functions-in-octave/

Octave Tutorials

Octave Tutorial on this website can be found at:
https://www.testingdocs.com/octave-tutorial/

More information on Octave can be found on the official website:
https://www.gnu.org/software/octave/index

Exit mobile version