You are on page 1of 5

I HC QUC GIA THNH PH H CH MINH

TRNG I HC BCH KHOA TP.H CH MINH


KHOA KHOA HC NG DNG
B MN TON NG DNG
--------*-------

BO CO BI TP LN
TI S: 5
GVHD: U TH PHIT
Nhm: ________
Nhm sinh vin thc hin:
H v tn
K1200353
21300440
41302105
41303560
G1300211
51300334
81303310
81301329
21303244
81302075
21304645

MSSV
V Trung Chin
Dip Th Cng
Trn Tun Linh
Phm Th Tn
Vng Hng Bn
Nguyn Hu Cm
inh Nh Qunh
L Nh Hong
Nguyn Vn Qu
Lu Ch Linh
L Th Cm T
Tp. HCM, thng 7 nm 2014

ti 5 Cho hm y=f(x) v gi tr x nhp t bn phm. Vit on code tm tip tuyn ca hm


ti x0 v v ng cong cng tip tuyn va tm

C s l thuyt:
+ nhp hm y=f(x) v gi tr x0 ;
+ Tnh cc gii hn ca hm khi hm tin v xx0 ;
+ So snh gii hn va tm c vi gi tr tm c ti im x0 xem hm c lin tc ti f(x)
hay khng;
+ V c tip tuyn ti im lin tc vi cng thc:
y = f(x0)*(x-x0) + y0
+xut ra mn hnh

Cc lnh c bn ca Matlab dng trong on code:


+ subs: gn gi tr vo hm
+ limit : tnh gii hn
+ if-else-end: chn lc im lin tc trn hm
+ while-end: to vng lp cho php nhp li gi tr x0
+ ezplot : v th ca hm vi bin syms
+ disp: xut k t - xung dng
+ fprint: xut k t - ni tip
+ axis nomal : gi khung li dng normal

Ni dung on code:

function Untitled
syms x u t y;
f=input('nhap ham f(x)= ');
x0=input('nhap x0 = ');
hold off
u=1;
while (u == 1)
t= subs(f,x0);
if (limit(f,x,x0) == t )
disp('ta duoc tiep tuyen tai diem x0');
u=2;
else
disp ('ham f(x) khong lien tuc tai diem x0');
disp('nhap lai');
x0= input('x0 = ');
u=1;
end
end
% phuong trinh tiep tuyen cua f(x) tai x0
disp('phuong trinh duong tiep tuyen');
y=subs(diff(f,x),x0)*(x-x0) + t;
fprintf('y= ');disp(y);
% ve duong cong f(x) va tiep tuyen cua no tai x0
ezplot(f)
hold on
ezplot(y);
grid on
axis normal
xlabel('truc x');
ylabel('truc y');
end

Phn 2 im :
cu 4.2.1.1
: f(x) = arctan(1/x^2), x # 0 ; f(x) = pi/2, x= 0 ; x0=0
syms x
>> f=atan(1/x^2);
>> f2=(f-pi/2)/x;
>> limit(f2,x,0);
>> ezplot(f,[-3,3])
>> hold on
>> ezplot(ans*(x-0)+pi/2,[-3,3])
Cu 4.2.8.2
: Vx: y=x^2; y=0; x+y=2.
>> m=x^2;
>> n=0*x;
>> k=2-x;
>> ezplot(m)
>> hold on
>> ezplot(n)
>> ezplot(k)
>> solve(m-n)
ans =
0
0
>> solve(n-k)
ans =
2
>> solve(k-m)
ans =
-2
1
>> V1=pi*int(((2-x)*2-x^4),-2,0);
>> V2=pi*int((2-x)^2-0,0,2);
>> V=V1+V2
V=
(124*pi)/15