Professional Documents
Culture Documents
A Report on
Author: Neeraj Mishra 07EE3202 Department of Electrical Engg. IIT Kharagpur Pratik Beley 11EE62R04 Department of Electrical Engg IIT Kharagpur
Introduction:
Electronic filters are electronic circuits which perform signal processing functions, specifically to remove unwanted frequency components from the signal. There are two types of filters Analog filters and digital filters. Digital filters operate on digitized analog signals, so the digitization process is important and can be critical in the system design. Digitization requires the analog signal to be sampled and then converted into a digital value, based on the amplitude of the sample
Filter Design:
Problem Statement: To design a notch filter of following specification Pass band 1: 1 Hz Stop band 1: 10 Hz Stop band 2: 100 Hz Pass band 2: 1000 Hz Pass band gain: 20 db Stop band gain: -20 db The Butterworth transfer function is very simple. It is merely: H () =
where n is the order. It follows from this that at w= 1, H (w) = 1/4, or 0.7071. This is -3dB relative to the zero frequency point, no matter what value of filter order is considered, since 1" = 1. For this reason the -3 dB cut-off frequency is considered the natural pass band edge. Attenuation for any filter order at other frequencies can be found by substituting different values of o and PZ. For example, at w = 3 and IZ = 5. Attenuation = = 47.7dB. Another way of looking at this is to find the filter order that will satisfy the attenuation requirements.
2
N= A= R=
Convert the frequency into radians Wp1 = 1* 2 * Hz Wp2 = 1000* 2 * Ws1 = 10* 2 * Ws2 = 100* 2 * Dp = Ds = Ws= = 11.1 Hz
Hz Hz
= 0.891 = 0.01
Nb
= 2.193
Nb = 3 Now Dp =
Wc = 1.419
Normalized low Pass transfer function H(s) = Now b = 2* For k = 1 b=1 H(s) =
MATLAB Program:
%% Analog Filter s=tf('s'); grid on; s1=(999*2*pi*s)/(s^2+(1000*4*pi*pi)); H=(1.419^3)*10/((s1+1.419)*(s1^2+1.419*s1+1.419^2)) H3=minreal(H) [num,den]=tfdata(H3); den{1} num{1} figure(1) bode(H3) grid on hold on %% Digital Filter s=tf('s');
4
[numd,dend]=bilinear(num1{1},den1{1},20000)
Many devices (particularly low-cost ones) use fixed point numbers, and the mathematics requires some thought. MATLAB does calculation in floating point so we have to first write code in fixed point and then implement it. We can either have 8 bit or 16 bit representation.
else smallest = den_smallest; end if (ceil(log(abs(largest))/log(2)) > ceil(log(abs(smallest))/log(2))) ; int_bits = ceil(log(abs(largest))/log(2)); else int_bits = ceil(log(abs(smallest))/log(2)); end
for k = 1:length(numd)
num_binary(k,1+l) = 1; end
end
for k = 1:length(dend)
end
Hd = tf(numd,dend,fsamp); display('------------------------------------------------------------------------------------------'); display('THE DIGITAL DOMAIN FILTER TRANSFER FUNCTION WITH FIXED POINT COEFFICIENTS IS:'); display(Hd); sum1 = 0;
sum2 = 0; gain = zeros(1,31416); phase = zeros(1,31416); for df = 1:31416 for k = 1:length(numd) sum1 = sum1 + numd(k)*exp((length(numd)-k)*(df-1)/10000*1i); end
subplot(2,1,2); df = 1:31416; semilogx((df-1)/31416*fsamp/2, gain(df)); title('DIGITAL DOMAIN MAGNITUDE RESPONSE WITH FIXED POINT COEFFICIENTS'); xlabel('Frequency [Hz]');
10
ylabel('Gain (dB)'); grid on; Now if we see the results for 8 bit representation we observe that the response of the filter becomes distorted as seen below
11