Home MathLab Scalar Functions in Matlab: E Matlab, Cosine Function and More

Scalar Functions in Matlab: E Matlab, Cosine Function and More

by Tutorial45

These are a few basic tools you will need to know if you are just starting learning Matlab.

Scalar functions in Matlab

Before fully diving into trigonometric functions, it is necessary to state that Matlab takes as input radians while working with trigonometric function meaning and uses the symbol pi for π

e-matlab

Trigonometric sine

e-matlab

Matlab code

sin(pi)

Trigonometric cosine

e-matlab

Matlab code

cos(pi)

Trigonometric tangent

e-matlab

Matlab code

tan(3*pi/2)

Trigonometric inverse sine (arcsine)

e-matlab

Matlab code

asin(1)

Trigonometric inverse cosine (arccos)

e-matlab

Matlab code

acos(0.5)

Trigonometric inverse tangent (arctan)

e-matlab

Matlab code

atan(3/2)

e Matlab (exponential)

e-matlab

Matlab code

exp(x)

Natural logarithm

e-matlab

Matlab code

log(5/2)

Absolute value

e-matlab

Matlab code

abs(a*x+b)

Square root

e-matlab

Matlab code

sqrt(a*b)

Remainder after division

This function helps you find the remainder after a division. We will use as an example the remainder of the division of 5 by 2, which is one.

Matlab code

rem(5,2)

which returns

e-matlab

Round towards nearest integer

This function will allow you to round values towards the nearest integer if you are not interested in working with decimal numbers. It is most useful while you want to round the result of an operation.

Matlab code

round(2.9)

Which returns

e-matlab

Round towards negative infinity

floor(x) rounds the elements of x to the nearest integers towards minus infinity.

Round towards positive infinity

As opposed to the floor function, ceil(x) rounds the elements of x to the nearest integers towards infinity.

Articles you might like:

Related Posts

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy