EXPERIMENT - 9


AIM

To design a 21st21^{st} order low pass FIR filter using Hamming Window.

THEORY

In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response (or response to any finite length input) is of finite duration, because it settles to zero in finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may continue to respond indefinitely (usually decaying).

MATLAB COMMANDS USED

* [b a]=butter(order,[W1 W2],'filter type');
* b=fir1(N,Wn);
* X=fft(x);
* f=filter(b,1,signal);

MATLAB CODE

clear all;
fs=2000;
f1=10;
f2=300;
t=0:1/fs:0.1;
yo=sin(2*pi*f1*t)
yn=2*sin(2*pi*f2*t)
y=(yo+yn)/3;
figure(1);

subplot(2,2,1)
plot(t,yo,'black');
title('Original Signal ');
ylabel('Amplitude')
xlabel('time');

subplot(2,2,2)
plot(t,yn,'black');
title('Signal To be Mixed.');
ylabel('Amplitude')
xlabel('time');

subplot(2,2,3)
plot(t,y,'black');
title('Mixed Signal');
ylabel('Amplitude')
xlabel('time');

N=1024;
Y=abs(fft(y,N));
fVals=(0:N/2-1)*fs/N;
figure(2);
plot(fVals,Y(1:N/2)/max(Y),'black');
title('Spectral Analysis of Signal');
ylabel('Magnitude')
xlabel('Frequency (Hz)');

b=fir1(21,15/fs);

figure(1);
filtered=filter(b,1,y);
subplot(2,2,4)
plot(t,filtered,'black');
title('Filtered Signal Using 21 order 
low pass FIR filter with Hamming window');
ylabel('Amplitude')
xlabel('time');

fvtool(b);

RESULT

The Specified filter has been designed and used to filter 300Hz300 Hz sine noise from 10Hz10 Hz sinusoidal signal.