You are on page 1of 12

Matlab Language

) (Technical Computing
.
.

)(Graphics)(Images
) . (Documents
) (Windows ). (Unix

) . (Matrix Laboratory
) (Array
.

).(Vectors


(
) :
)](Add-on application specific solutions [tool boxes

)(Manipulating Matrices

).(cells
Row -4-

cell

Row -3-

Row -2Row -1Column Column Column Column Column

-5-

-4-

-3-

-2-

-1-

Matlab as a calculator

^ + , - , * , / ,
.
:

-1 .
-2

)(>>2+3^2 2+9=11

-3 :

)(>>3*4/5=12/5

-4 :

)(>>3+4-5=7-5

>> 2+3/4*5
= ans
5.7500

Numbers and Formats :


.
Type

Examples

Integer

1362 , -217898

Real

1.234 , -10.005

Complex

3.21-4.3i )i=-1)

Inf

Infinity (result of dividing by zero)

NaN

Not a Number (0/0)

(Power of ten scale factor) ( e)

-1.3412e+03 = -1.3412 x 103= -1341.2


-1.3412e-01 = -1.3412 x 10-1= -0.13412
(double precision)

)(Variables
) (ans
.
>> 3-2^4
=ans

-13
>>ans*5
=ans
-65
( .)x , y
>> x=3-2^4
=x

-13
>> y=x*5
=y
-65

)(Variable Names
31
.
:

NetCost , left2pay , x3 , X4 , z25c5


:
Net-Cost , 2pay , %x , @sign

) (Complex Numbers
) (-1 ) (i ) (j .
>> i , j , i = 3
ans= 0+1.0000i
ans= 0+1.0000i
i=3

)(Outputs

);( )(semi-colon
>> x=-13 ; y=5*x , z=x^2+y
=y
-65

=z
104
) (x );(
) (commas ).(semi-colon

)(Built In Functions
-1 )(Trigonometric Functions
sin , cos , tan , sec (
) )(radians
: )(x,y .
)>>x=5*cos(pi/6), y =5*sin(pi/6
x,y

r=5
=/6=30

=x
4.3301
=y

2.5000
) (Inverse Trigonometric asin , acos ,
atan ) (sin-1 , cos-1, tan-1 .

(Elementary Functions) -2
log10 , log (inverse of ex) , exp (ex) , sqrt

:
>>x=9;
>>sqrt(x),exp(x),log(sqrt(x)),log10(x^2+6)
ans=
3
ans=
8.1031e+03
ans=
1.0986
ans=
1.9395

Homework:
) (matlab :

10
( x1
) ) (9 * 8 1 5
)(4 2 * 8
15 5
(w
) ) (9 * 8 1 5
4 2 *8
2

You might also like