You are on page 1of 1

clc;

clear all;
close all;
h1 = input('Enter th1e values of h1 \n');
N = length1(h1);
n = 0:N-1;
% for type-1
L = (N-1)/2; % order of H1r
a = [h1(L+1) 2*h1(L:-1:1)]; % type-1 LPF coeffs
i = 0:1:L;
w = [0:1:500]'*pi/500; % 500 freq between [0 pi]
H1r = cos(w*i)*a'; % amplitude response
amax = max(a)+1;
amin = min(a)-1;
subplot(221), stem(n,h1), axis([-1 2*L+1 amin amax]);
xlabel('n'), ylabel('h1[n]'), title('Impulse Response');
subplot(222), plot(w/pi, H1r), grid on;
xlabel('freq in pi units'), ylabel('H1r'),
title('Type-1 Amplitude Response');
subplot(223), stem(0:L, a), axis([-1 2*L+1 amin amax]);
xlabel('n'), ylabel('a[n]'), title('a[n] coeffs');
subplot(224), zplane(h1,1), title('Pole-zero plot');

You might also like