from Signal Processing & Linear Systems Companion Software by B. P. Lathi
Companion software for Signal Processing & Linear Systems

C1211.m
clear;clg;
N=7;
H=[1 1 0 0 0 0 1];
for i=1:N
   r=i-1;
   Hr(i)=H(i)*exp(-j*r*pi*(N-1)/N);
end
k=0:6
hk=ifft(Hr);
subplot(2,1,1);
stem(k,hk);
xlabel('k');ylabel('h[k]');

M=512
hE=[hk zeros(1,M-7)]
HE=fft(hE);
subplot(2,1,2);
r=0:M-1;
W=r.*2*pi/512
plot(W,abs(HE));
xlabel('W');ylabel('F(W)');grid;



Contact us at files@mathworks.com