You are on page 1of 3

M U V MATLAB

I.

MT S LNH C BN
1. clc : Xa ca s lnh
2. clear : Xa cc mc trong b nh
3. demo : Chy chng trnh c sn mt s hng dn ca Matlab
4. disp : Hin ni dung ra mn hnh
5. format : nh dng kiu hin th cc s trong matlab
6. length : Hin th chiu di vecto
7. size : Hin th cp ca ma trn

II. MT S TON T

Ton t

Cng dng

<

So snh nh hn.

>

So snh ln hn.

>=

So snh ln hn hoc bng.

<=

So snh nh hn hoc bng.

==

So snh bng nhau c phn thc v phn o.

-=

So snh bng nhau phn o.

&

Thc hin php ton logic V.

Thc hin php ton logic HOC.

Thc hin php ton logic NOT.

III. HM TON HC
Hm trong matlab
exp(x)
sqrt(x)
acos(x)
abs(x)
imag(z)
conj(z)
round(x)

Hm thc t
ex
x1/2
arccosx
|x|
Imz

Hm trong matlab
log(x)
sin(x)
sinh(x)
real(z)
angle(z)
rem(x,y)

Lm trn x

sign(x)

Hm thc t
lnx
sinx
sinhx
Rez
argz
Phn d ca php
chia x:y
Du ca x (1 nu
x>0)

IV. LNH TRONG GII TCH


LNH
subs(f,x,x0)
eval(f)
solve()
dsolve()
limit(f,x,a,left)

KT QU
Gi tr hm f ti x0
Cp nht hm f sau khi i bin
Gii pt hoc hpt
Gii pt hoc hpt vi phn

lim f

xa
n

diff(f,x,n)

int(f), int(f,a,b)

( x)
b

f x dx, f x)dx
a

taylor(f,x,n)

n1

k
f (a)

k 0

k!

factorial(n)
factor(f)
expand()
residue(a,b)

x a k

n!
Phn tch a thc f thnh nhn t
Khai trin thnh a thc
Phn tch hm hu t thnh tng cc phn
thc n gan
V ng cong trong mp Oxy
T mu trong mp Oxy
Gn tn string cho hnh v
Gn tn cho 2 trc ta
Gn tn cho tng ng cong

ezplot()
fill()
title(string)
xlabel, ylabel
legend

V. LNH TRONG I S TUYN TNH


LNH
sym2poly

KT QU

x3 x 2 3 3 0 1 3

poly2sym

conv(a,b)c
[q,r]=deconv(a,b)

Nhn 2 a thc vit dng ma trn


Chia 2 a thc vit dng ma trn, thng l q, phn
d l r
Tm nghim a thc vit dng ma trn
To ma trn 0 cp mxn
To ma trn bc thang rt gn cp mxn
AT

roots( a)
zeros(m,n)
eye(m,n)
A
rank(A)

0 1 3 x3 x 2 3

Hng mt A
-1

inv(A) hoc A

A-1

A\B

Chia ngc ma trn (A\B = inv (A)*B).

A(: , j)

Ch ct th j ca ma trn A

A(i , :)

Ch hng th i ca ma trn

A(: , :)

Ch ton b ma trn A

A(j , k)

Ch phn t A(j), A(j+1)A(k)

A(: , j , k)

Ch cc phn t A(:, j), A(:, j+1)A(:, k)

A(:)

Ch tt c cc thnh phn ca ma trn A

[m,i]=max(A) hoc min(A)

m:phn t ln nht mi ct ca mt A, i: V tr ca m

[kq,i]=sort(A)

Sp xp theo th t tng dn tng ct ca mt A; i l


v tr cc phn t trc khi sp xp

det(A)

det(A)

trace(A)

Tng cc p.t nm trn ng cho ca A

inv(A)

A-1

AT

[s d]=jordan(A)

s-1.a.s=d: cho ha thng s l mt kh nghch

[s,d]=eig(A)

s-1.a.s=d: cho ha trc giao s l mt trc giao

B=rref(A)

B l mt bc thang rt gn tng ng hang vi A

dot(a,b)

Tch v hng ca 2 vecto

VI. NHM LNH KHI V HNH


1.
2.
3.
4.
5.
6.
VII.

axes: t v tr cc trc ta
axis: t li trc ta
xlabel, ylabel, zlabel: t tn trc ta
grid on (off): m (tt) li trn trc
hold on (off): gi (b) cc ng cong trn cng hnh v
set: t tnh cht cho 1 i tng no
MT S LNH KHI VIT CODE
1. input: Nhp gi tr t bn phm
2. eval : Cp nht li hm sau khi i bin
VD:
Cho f=x+2y,
i bin: x=r*cos(phi);y=r*sin(phi);
Cp nht li hm f: f=eval(f)=r*cos(phi)+2*r*sin(phi)
3. for . endfor : To vng lp khi bit s ln lp
4. while end :To vng lp khi cha bit s ln lp nhng bit iu kin dng vng
lp
5. if elseif else end: thc hin lnh khi bit iu kin
6. pause: Dng chng trnh ang chy
7. fprintf: Xut d liu ra mn hnh