lettura simple

Sine Function in Octave

Calculating the sine of an angle in Octave is straightforward with the "sin" function.

sin(x)

This function computes the sine of an angle x, where x is measured in radians.

For example, to determine the sine of 1 radian, you simply input sin(1).

sin(1)

The outcome, the sine of one radian, is 0.8415.

ans = 0.8415

However, if you have an angle measured in degrees, there's an additional step involved before you can calculate the sine. This angle first needs to be converted into radians using the "deg2rad" function.

To illustrate, if you wish to compute the sine of a 45-degree angle, you would enter sin(deg2rad(45))

sin(deg2rad(45))

Executing this command will yield the sine of 45 degrees.

ans = 0.7071




Report a mistake or post a question




FacebookTwitterLinkedinLinkedin