Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Bài 1: Dùng Matlab xác định đáp ứng xung của các hệ dưới đây

a, y[n] + 0.2y[n-1] = x[n]-x[n-1]


n=-10:10;
num=[1 -1];
dem=[1 0.2];
h=impz(num,dem,n);
stem(n,h);
title('Bai 1a');
b, y[n] + 1.2y[n-1] = 2x[n-1]
n=-20:20;
num=[0 2];
dem=[1 1.2];
h=impz(num,dem,n);
stem(n,h);
title('Bai 1b');
c, y[n] = 0.24(x[n]+x[n-1]+x[n-2]+x[n-3])
n=-10:10;
num=[0.24 0.24 0.24 0.24];
dem=[1];
h=impz(num,dem,n);
stem(n,h);
title('Bai 1c');
d, y[n] = x[n] + 0.5x[n-1] + x[n-2]
n=-10:10;
num=[1 0.5 1];
dem=[1];
h=impz(num,dem,n);
stem(n,h);
title('Bai 1d');
Bài 2: Thực hiện phép nhân tổng chập bằng chương trình Matlab
a, x[n] = u[n] - u[n-4], v[n] = ¿ u[n]
n=-5:15;
xn=[zeros(1,5) ones(1,4) zeros(1,12)];
u=[zeros(1,5) ones(1,16)];
v=(0.5).^n;
vn=v.*u;
y=conv(xn,vn);

subplot(3,1,1);
stem(n,xn);
xlabel('n');
ylabel('x[n]');
subplot(3,1,2);
stem(n,vn);
xlabel('n');
ylabel('v[n]');
subplot(3,1,3);
p=-10:30;
stem(p,y);
xlabel('n');
ylabel('y[n]');
b, x[n] = [1 4 8 2]; v[n] = [0 1 2 3 4] (the sequences both start at n=0)
x=[1 4 8 2];
v=[0 1 2 3 4];
y=conv(x,v);

subplot(3,1,1);
m=0:3;
stem(m,x);
xlabel('n');
ylabel('x[n]');
subplot(3,1,2);
n=0:4;
stem(n,v);
xlabel('n');
ylabel('v[n]');
subplot(3,1,3);
p=0:7;
stem(p,y);
xlabel('n');
ylabel('y[n]');
c, x[n] = u[n], v[n] = 2¿ u[n]
n=-5:15;
u=[zeros(1,5) ones(1,16)];
xn=u;
v=2*((0.8).^n);
vn=v.*u;
y=conv(xn,vn);

subplot(3,1,1);
stem(n,xn);
xlabel('n');
ylabel('x[n]');
subplot(3,1,2);
stem(n,vn);
xlabel('n');
ylabel('v[n]');
subplot(3,1,3);
p=-10:30;
stem(p,y);
xlabel('n');
ylabel('y[n]');
d, x[n] = u[n-1], v[n] = 2¿ u[n]
n=-5:15;
xn=[zeros(1,6) ones(1,15)];
u=[zeros(1,5) ones(1,16)];
v=2*((0.5).^n);
vn=v.*u;
y=conv(xn,vn);

subplot(3,1,1);
stem(n,xn);
xlabel('n');
ylabel('x[n]');
subplot(3,1,2);
stem(n,vn);
xlabel('n');
ylabel('v[n]');
subplot(3,1,3);
p=-10:30;
stem(p,y);
xlabel('n');
ylabel('y[n]');

You might also like