Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

BLN DSP

Cu b)
a=[1 -0.7];
b=[1 0];
[H w]=freqz(b,a,128)
magH=abs(H);
figure(1)
plot(w/pi,magH);
title('Dap ung bien do')
xlabel('Tan so w/pi');
ylabel('Bien do dB');

Cu c)
h=zeros(1,51);
for n=1:51
h(n)=(0.7^n)*u(n);
end
figure(2)
stem(h)
xlabel('n');
ylabel('h');

Cu d)
delta=[0 0 1 zeros(1,48)];
%ve y(n)
//y1=zeros(1,2*m2+1);
y1=conv(h,delta);
figure (3)
subplot(2,1,1)
xlabel('n');
ylabel('delta');
stem(delta);
title('ve y(n) khi x(n)=delta(n-3)')
xlabel('n');
ylabel('delta');
subplot(2,1,2)
stem(y1)
xlabel('n');
ylabel('y');

Cu e)

n0=2;n1 = 0;n2 = 50;


n = [n1:n2];
u2= [(n-n0)>=0];
x1=u-u2;
y2=conv(x1,h);
figure(4)
subplot(211)
stem(x);
title('ve y(n) khi x(n)=u(n)-u(n-2)')
xlabel('n');
ylabel('x');
subplot(212)
stem(y2)
xlabel('n');
ylabel('y');

Cu f)
x2(n) = power(0.5,n)
y3=conv(x2,h);
figure(5)
subplot(211)
stem(x2)
title('ve y(n) khi x(n)=0.5^n*u(n)')
xlabel('n');
ylabel('x');
subplot(212)
stem(y3);
xlabel('n');
ylabel('y');

You might also like