Vous êtes sur la page 1sur 15

DIGITAL SIGNALS PROCESSING

Complex Engineering Problem

Design of FIR and IIR Filters


Group Members

ARFAN SHAHZAD 15-EE-100


NOUMAN SAEED 15-EE-104
TEHZIB-ul-HASNAIN 15-EE-184
Filter Design

FIR (finite impulse response)


 Frequency sampling method
 Windowing method
Filter Design

IIR (infinite impulse response)


 By impulse invariance method
 Bilinear transformation method
Characteristics

 FIR can achieve desirable linear phase response


 FIR are inherently stable (absolutely summable)
 IIR has low order (lower complexity)
 IIR needs attenuation for stability
FILTER DESIGN PARAMETERS

 Stop band frequency (Ws) ([415,425],[745,755] FIR)


([410,430],[740,760] IIR)
 Pass band frequency (Wp) ([410,430],[740,760] FIR)
([370,470],[700,800] IIR)
 Stop band attenuation (As) (-60 dB)
 Pass band Ripples (Ap) (0.1dB)
 Transition Bandwidth (60 Hz FIR) (40 Hz IIR)
FIR DESIGN BY WINDOWING METHOD

 From given specification parameters determine the ripples $s and $p


as
Ap = 20log10[(1+$p)/(1-$p)]= 0.1dB; $p = 0.0058
As = -20log10($s) = -60dB $s = 0.0010
 Determine the cut off frequency as
Wc = (Ws+Wp)/2 = ([370 470], [700,800] FIR)
([390,450], [720,780] IIR
 Determine the design parameter as
A=-20log10($)=As=60dB
Transition bandwidth= deltaW=Ws- Wp=([60Hz FIR], [40Hz IIR])
FIR DESIGN BY WINDOWING METHOD

 Select the approximate window of desired A


and find the order of filter
M=L-1
Blackman Window having As of 60dB
Determine the impulse response using filter
commands i.e. FIR1 and FIR2
 Check whether the design filter satisfies the
prescribed specification, if not increase the
order of filter
PLOT NOISY SIGNAL

load('noisy_signal.mat')
y = (noisy_signal);
time = 10;
[l w] = size(noisy_signal);
Fs = l/time;
n = [0:1:length(noisy_signal)-
1]*1/Fs;
figure (1)
plot(n,y)

title('Noisy Signal');
xlabel('Time (s)');
ylabel('Amplitude');
//Fourier Transform of Noisy Sig

NFFT_input =
2^nextpow2(L_input)
Y = fft(input,NFFT_input)/L_input;
f=
Fs/2*linspace(0,1,NFFT_input/2+1)
;
plot(f,(abs(Y(1:NFFT_input/2+1))))
xlabel('Frequency(Hz)')
ylabel('Magnitude')
title('Spectrum of Noisy Signal')
Now to find the frequencies of noise

noise = input(60000:80000); // here it is pure noise


//F.T. OF Noise
L_noise = length (noise);
NFFT_noise = 2^nextpow2(L_noise)
Y = fft(noise,NFFT_noise)/L_noise;
f = Fs/2*linspace(0,1,NFFT_noise/2+1);
plot(f,20*log10(abs(Y(1:NFFT_noise/2+1))))
xlabel('Frequency(Hz)')
ylabel('Magnitude')
title('Spectrum of Noise’ )
Noise Frequencies : 420Hz and 750Hz with max amplitude of 0.025
FIR design using fir1() function
wp_L = [370/4000 , 470/4000] ;
wp_H = [700/4000 , 800/4000] ;

fir_L = fir1(412,wp_L,'stop',hann(413));
fir_H = fir1(412,wp_H,'stop',hann(413));
fir_filter = conv(fir_L,fir_H);

filtered_signal=conv( fir_filter,input);
IIR design using Butter() and Butterord()
Ap = 0.1; As = 32;
wp1 = 370/4000; wp2 = 470/4000 ; ws1 = 410/4000; ws2 = 430/4000
;
wp3 = 700/4000; wp4 = 800/4000 ; ws3 = 740/4000; ws4 = 760/4000
;
[NL,WcL] = buttord([wp1 wp2],[ws1 ws2],Ap,As)
[BL,AL] = butter(NL,WcL,'stop’);

[NH,WcH] = buttord([wp3 wp4],[ws3 ws4],Ap,As);


[BH,AH] = butter(NH,WcH,'stop’);

Bt=conv(BL,BH);
At=conv(AL,AH);
filtered_signal=filter( Bt,At,noisy_signal);

Vous aimerez peut-être aussi