%y(n) - 2y(n-1)= x(n) – 0.6x(n-1)
clear;clc;close all;
b=[1/3 1/3 1/3];
a=1;
[H,w]=freqz(b,a);
subplot(221);
plot(w,abs(H));axis tight;
title('dac trung bien do');
subplot(222)
plot(w,angle(H));axis tight;
title('dac trung pha');
subplot(223)
impz(b,a)
title('dap ung xung');
subplot(224)
stepz(b,a)
title('quan sat y(n) khi x(n)=u(n)');

figure(2)
n=0:100;
x=cos(.2*pi*n);
y=filter(b,a,x);
plot(n,x,n,y);
legend('in','out')


