You are on page 1of 2

Different types of arithmetic, exponential, trigonometry and complex number operations

handled easily with MATLAB codes.

Example: 1
53 /(24 + 1)
Code: >> 5^3/(2^4+1)

ans =

7.3529

Example: 2
3[(sqrt4-2)/(sqrt3+1)2]-5

To compute this formula: , you can always break down the commands and simplify the code
(a final value can be achieved in several ways).

>> numerator = 3 * (sqrt(4) - 2)

numerator =

>> denominator = (sqrt(3) + 1)^2

denominator =

7.4641
total=numerator/denominator-5

total =

-5

Example: 3

x=2, y=3

x=

y=

>> exp(4)+log10(x)-pi^y

ans =

23.8929
(sin(pi/2))^2 + tan(3*pi*x)

ans =

1.0000

MATLAB recognizes the letters i and j as the imaginary number. A complex number 4 +
5i may be input as 4+5i or 4+5*i in MATLAB
The first case is always interpreted as a complex number, whereas the latter case is taken as
complex only if i has not been assigned any local value.

Example:

You might also like