You are on page 1of 18

Mt vi v d matlab

http://chunguv.blogspot.com

Bn c th download ti liu ny v t blog: http://chunguv.blogspot.com Website cung cp y ebook v : acad, 3dsmax, etabs, sap2000, ms project, photoshop.. Ghi ch: Chng ti khng chu trch nhim v bn quyn ca ti liu c pht hnh. Tt c ti liu do chng ti pht hnh u c ngun gc r rng v c chn lc mt cch kht khe mang li cho bn c nhng ti liu tt nht. Chc mi ngi thnh cng !

Mt vi v d matlab 6.Vit hm tnh t hp n chp r theo cng thc sau:

http://chunguv.blogspot.com

Bi gii:

Mt vi v d matlab

http://chunguv.blogspot.com

Bi gii: Khi to ma trn A.

Cript file c vit nh sau:

Mt vi v d matlab

http://chunguv.blogspot.com

Bi gii: a. S dng php ton trn ma trn. b. S dng for. Khi to mt vector ngu nhin 1.000.000 phn t. A=rand(1:1000000) Vit cript file:

Bi gii: Khi to cc vector. a.Cript file

Mt vi v d matlab

http://chunguv.blogspot.com

Kt qu: b.Cript file

Kt qu:

Bi gii:

Kt qu: 5

Mt vi v d matlab

http://chunguv.blogspot.com

Bi gii: Khi to mt ma trn A=rand(9,8).

a.Cript file

Mt vi v d matlab

http://chunguv.blogspot.com

Kt qu:

b.Crip file

Bi gii: V th. Khi to x=1:1/1000:4 Hm s f(x)=x Gi hm plot(x,x)

Mt vi v d matlab

http://chunguv.blogspot.com

V th f(x)=x3 Gn y=x.^3 Gi hm plot(x,y) Kt qu:

Mt vi v d matlab

http://chunguv.blogspot.com

V th hm ex. Gn y=exp(x) Gi hm plot(x,y)

V th hm ex2. Gn y=exp(x.^2) Gi hm plot(x,y)

Mt vi v d matlab

http://chunguv.blogspot.com

clear all x=0.01:0.0001:0.1 y=sin(x.^(-1)) plot(x,y) kt qu:

Lnh c gi: plot(x,y-- + red) Kt qu:

10

Mt vi v d matlab

http://chunguv.blogspot.com

plot(x,y,'-. ^ blue')

plot(x,y,'-. d green') 11

Mt vi v d matlab

http://chunguv.blogspot.com

plot(x,y,'-- o black')

12

Mt vi v d matlab

http://chunguv.blogspot.com

x=-5:0.5:5 y=x./(1+x.^4) plot(x,y,'-. o red','LineWidth',2,'MarkerEdgecolor','k','MarkerFacecolor','g','Markersize',6) kt qu:

x=-pi:pi/100:pi y=sin(x) z=sin(3*x) plot(x,y,-- black) hold on plot(x,z,-. blue) hold off

13

Mt vi v d matlab

http://chunguv.blogspot.com

Kt qu thu c.

G lnh: clear all x=0:0.2:20 subplot(1,2,1) f=sin(x) plot(x,f) x=0:0.2:25 subplot(1,2,2) g=50*x plot(x,g) Kt qu thu c:

14

Mt vi v d matlab

http://chunguv.blogspot.com

Cc thao tc: t = 0:pi/20:2*pi [x,y] = meshgrid(t) plot(3*sin(t),3*cos(t)) axis equal grid on axis([-6 6 -6 6]) Kt qu:

15

Mt vi v d matlab

http://chunguv.blogspot.com

Cc thao tc: t=0:pi/100:2*pi y=sin(t) plot(t,y). 16

Mt vi v d matlab

http://chunguv.blogspot.com

Cc thao tc; clear all t=0:pi/6:30 y=cos(t) plot(t,y) xlabel(Thoi gian (t)) ylabel(Ham so x(t)) title(x(t)=cos(t))

y=2+3*.(sin(pi.*t+10))*(*exp.(-0.35.*t))

17

Mt vi v d matlab

http://chunguv.blogspot.com

18

You might also like