BÀI TẬP VỀ NHÀ Bài : +) code : M = [1 0; j 1; j j+1 -3]; V = [M M;M M]; V(2,:) = []; V(:,3) = []; z = V(4,:); V(4, 2) = j+5; Bài 3: +)code: A = [-1 3.5 2; -1.3; 1.1 1.9]; B = [1 -1; -1.5 1.5 -3; 1 ]; C = A*B +) kết : C = [-4.25 7.25 -7.5; -2.8 0.2 -4.3; 4.9 -5.2] Bài : +) code: A = [-1 3.5 2; -1.3; 1.1 1.9]; C = diag(diag(A)) +) kết quả: C=[-1 0; 0; 0 1.9] Bài 10: +) code: t = (0 :0.1: 10); s = sin(2*pi*5*t).*sin(2*pi*3*t) +)kết quả: Bài 11: +) code: t = (0:0.1:10); s = 20 *sin(2*pi*5*t); lamtron = round(s) Bài 12: +)code: b = [1024 1000 100 1] logarith2 = log2(b) logarith10 = log10(b) +)kết : Bài 13: +)code: w = (0.01:0.01:5); H1 = 1./(j*w); H2 = 1./ (1 + j*w); plot(w, abs(H1)); title('Do thi bien qua bo tich phan'); figure plot(w,abs(H2)); title('Do thi bien cua phan tu tre thoi gian'); figure plot(w, abs(H1)); title('Do thi bien qua bo tich phan'); figure semilogy(w,abs(H1)); loglog(w,abs(H1)); +) kết quả: Bài 14: +) code: w = (0.01:0.01:5); H1 = 1./(j*w); H2 = 1./ (1 + j*w); subplot(2,2,1) plot(w, abs(H1)); title('Do thi bien qua bo tich phan'); subplot(2,2,2) plot(w, angle(H1)); title('Do thi pha qua bo tich phan'); subplot(2,2,3) plot(w,abs(H2)); title('Do thi bien cua phan tu tre thoi gian'); subplot(2,2,4) plot(w,angle(H2)); title('Do thi pha cua phan tu tre thoi gian'); +) kết quả: Bài 16: +) code: t=0:10:360; p=0:10:360; R=3; [T,P]=meshgrid(t,p); Z = R*sin(pi*T./180); X = R*sqrt(R^2-Z.^2).*cos(pi*P./180); Y = R*sqrt(R^2-Z.^2).*sin(pi*P./180); surf(X,Y,Z); xlabel('x-axis'); ylabel('y-axis'); zlabel('F'); +)kết quả: Bài 17: +) code: y =(1:0.5:5); L=length(y); k=0; disp('vecto yr la : ') for i=1:L yz(i)= y(L-i+1); end; for i=1:L if (rem(y(i),1)==0) k= k+1; z(k)=y(i); end end disp('vecto chua cac so nguyen y : ') z +)kết quả: Z= [1 ] ... Bài 11: +) code: t = (0:0.1:10); s = 20 *sin(2*pi*5*t); lamtron = round(s) Bài 12: +)code: b = [1024 1000 100 1] logarith2 = log2(b) logarith10 = log10(b) +)kết : Bài 13: +)code:... title(''Do thi bien qua bo tich phan''); figure semilogy(w,abs(H1)); loglog(w,abs(H1)); +) kết quả: Bài 14: +) code: w = (0.01:0.01:5); H1 = 1./(j*w); H2 = 1./ (1 + j*w); subplot(2,2,1) plot(w, abs(H1));... gian''); subplot(2,2,4) plot(w,angle(H2)); title(''Do thi pha cua phan tu tre thoi gian''); +) kết quả: Bài 16: +) code: t=0:10:360; p=0:10:360; R=3; [T,P]=meshgrid(t,p); Z = R*sin(pi*T./180); X = R*sqrt(R^2-Z.^2).*cos(pi*P./180);