Program:
clc;
clear all;
b = [1,-1];
a = [0.9,-2,1];
[h,w] = freqz(a,b);
subplot(2,2,1);
mag = db(abs(h));
plot(w,mag);
xlabel('Normalized Frequency ---->');
ylabel('Magnitude in dB ---->');
title('Magnitude Response');
subplot(2,2,2);
h2 = (angle(h)*180/pi);
plot(w,h2);
xlabel('Normalized Frequency ---->');
ylabel('Phase in degrees ---->');
title('Phase Response');
x = [1,2,3,4,5];
y = [3,8,11];
z = conv(x,y);
subplot(2,1,2);
stem(z);
xlabel('n ---->');
ylabel('x(n) ---->');
title('Time Response');
Waveform:
clc;
clear all;
b = [1,-1];
a = [0.9,-2,1];
[h,w] = freqz(a,b);
subplot(2,2,1);
mag = db(abs(h));
plot(w,mag);
xlabel('Normalized Frequency ---->');
ylabel('Magnitude in dB ---->');
title('Magnitude Response');
subplot(2,2,2);
h2 = (angle(h)*180/pi);
plot(w,h2);
xlabel('Normalized Frequency ---->');
ylabel('Phase in degrees ---->');
title('Phase Response');
x = [1,2,3,4,5];
y = [3,8,11];
z = conv(x,y);
subplot(2,1,2);
stem(z);
xlabel('n ---->');
ylabel('x(n) ---->');
title('Time Response');
Waveform: