Sunteți pe pagina 1din 7

Than Lwin Aung

EGR 315

Project 2

Digital Filters

Introduction

The purpose of this project is to design and construct different digital filters to demodulate the AM signal. Digital filters can be grouped into FIR (Finite Impulse Response) Filter and IIR (Infinite Impulse Response) Filter, depending on their transfer function characteristics.

IIR (Infinite Impulse Response) Filter

A SISO (Single Input and Single Output) system can be described by the mathematical equation:

In discrete form, it can be described as:

Therefore,

(1)





(2)

(3)

The equation (3) shows the recursive form of the equation (2), and it can be easily implemented on the computer, and the subtraction part of equation (3) forms the negative feedback loop from the output to the input. Although one can solve the equation (3) to calculate the values of a and b, a better approach is to derive the values of a and b from the analog description of the transfer function by using bilateral transformation from to s Domain to z Domain . Depending on the values of a and b, there are different types of filters (both digital and analog counter-parts), such as Butterworth, Chebyshev etc, with different filtering properties.

FIR (Finite Impulse Response) Filter

Unlike IIR, FIR only use input in filtering, and it can be represented by removing the feedback loop from the equation (3). Therefore, the equation will take the following form :



(4)

The ideal filter is a rectangular window in frequency domain; however, since the time domain counterpart of rectangular is a sinc function with infinite length, it is impossible to implement a perfect rectangular window. The best we can do is to approximate the ideal filter by windowing, sampling and shifting .

AM (Amplitude Modulation)

According to the Fourier Transform, multiplying a signal x(t) with a e -jwt will result in frequency shift X(s + ω) in frequency domain. Actually, amplitude modulation exploits this feature to modulate the analog signals.

Than Lwin Aung

EGR 315

Project 2

Modulated signal y(t) = Input Signal x(t) × Carrier Signal c(t)

, where c(t) is a sinusoidal wave, which takes the form: Acos(ω c +θ). When analyze the frequency spectrum of the modulated signal, we can see the baseband of the input signal is shifted towards the carrier frequency. Figure1: the baseband of the input signal is shifted by the carrier frequency

Once the input signal is demodulated, it is transmitted to the receiver. At the receiver ends, the demodulation is carried out to reconstruct the input signal. Demodulation involves multiplying the input modulated signal with the carrier frequency to shift back to baseband of the input signal, then by low-pass filter the unnecessary components of upper side band frequencies.

Design and Implementation of Filters

The input signal is sampled at 8K Hz and it is modulated on a carrier frequency of 4K Hz. Therefore, the modulated signal is shifted to the 4K Hz frequency as in the following frequency spectrum. Than Lwin Aung

EGR 315

Project 2

In order to shift the frequency back to the baseband, the modulated signal is multiplied by the carrier frequency again. The result is as follows: Although the signal is shifted back to the baseband, we can still clearly those there unnecessary frequency components at the upper sideband. In order to get rid of the unnecessary frequency we need to design the low-pass filter.

We designed and implemented both types of digital filters, IIR and FIR, and also compared the performance of the filters by analyzing their strengths and drawbacks. Since we know the cut-off frequency, which is ½ of the half of sampling frequency, we can calculate the coefficients values of the equation (3) and (4) by solving linear equations. However, digital filter designs in Mathlab makes our life a lot easier by providing us with built-in commands for designing filter. The detailed implementation of the both Mathlab and labview are attached in the appendices.

Results and Discussion

First, we applied the low pass digital FIR filter to the modulated signal. The FIR employs FIR1 from Mathlab and its cut-off frequency is 0.35, the number of order (taps) is 10. Than Lwin Aung

EGR 315

Project 2

From the figures, we can see that although the cut-off frequency starts at 0.35, its stop band is not clear enough to cut off the unnecessary. Therefore, the resulted demodulated signal’s spectrum shows some components at the upper band.

Second, we applied the low-pass IIR to the modulated. For our IIR, we use Butterworth with the order of 10 th . We also used the same cut-off frequency at 0.35. From the figures, we can see that the IIR filter spectrum is better than FIR, with better stop-band and pass-band. Once we implemented the filters with Mathlab, we also implemented the filters with Labview by employing the same design and procedure.

Generally, FIR is stable as its poles are always on LPH and it doesn’t require feedback loop, which makes calculation a lot easier. Also, since FIR doesn’t have feedback loop, it can provide a linear phase response: the phase of output signal is linear to the phase of input signal. However, as we can see, with the same order, the IIR can provide better stop-band and pass-band.

References

 Bishop H. Robert., “Labview” 2 nd Edtion Prentice Hall Inc., 2007.

 Lathi ., Signal Processing and Linear Systems, Oxford University Press, 2000 (ISBN

0195219171).

Than Lwin Aung

EGR 315

Project 2

Appendix A Mathlab Script File

clear;

%Import Signal Data from Excel File

%Transpose the imported signal

 y = transpose(y); L = length(y);

%Sampling Frequency

fs

T

= 8000;

= 1/fs;

%Calculation of Time Domain t = (0:L-1)*T;

subplot(3,3,1); plot(t,y); title('Modulated Signal'); %Transform to Frequency Domain

 Y = fft(y); n = length(Y);

freq =[-n/2:n/2-1]/n;

subplot(3,3,2);plot(freq,abs(Y)); title('Freq Spectrum of Modulated

Signal');

%Carrier Signal

fc = 4000;

c = cos(pi*fc*t);

%Multiply with Carrier Signal

x

= c .* y;

X

subplot(3,3,3);plot(freq,abs(X)); title('Freq Spectrum of Shifted

= fft(x);

Demodulated Signal');

%FIR Filter Design using Fir1

n = 10;

wc = 0.35; % cut off frequency

%10th order

%Y[n] = a0X[n] + a1X[n -1] + a2X[n-2] + a3X[n-3] + a4X[n-4] + a5X[n-5]

[bf af] = fir1(n, wc,'low');

[Hf f] = freqz(bf,af,L,fs);

Than Lwin Aung

EGR 315

Project 2

subplot(3,3,4); plot(freq+0.5,abs(Hf)); title('Freq Spectrum of FIR Filter );

% Filter the signal

gf = filtfilt(bf,af,x);

%

Gf = fft(gf); Gf = fftshift(Gf);

subplot(3,3,5);plot(freq,abs(Gf));title('Freq Spectrum of Filter

Demodulated Signal'); subplot(3,3,6); plot(t,gf);title('Demodulated Signal');

%IIR Filter Design using Butterworth

n = 10;

wc = 0.35; %cut off frequency

%10th order

%Y[n] = a0X[n] + a1X[n -1] + a2X[n-2] + a3X[n-3] + a4X[n-4] + a5X[n-5] +

% = - (b0Y[n-1] + b1Y[n-2] +

[bi ai] = butter(n, wc,'low');

[Hi f] = freqz(bi,ai,L,fs); subplot(3,3,7); plot(freq+0.5,abs(Hi)); title('Freq Spectrum of IIR Filter

 '); % Filter the signal

gi = filtfilt(bi,ai,x);

Gi = fft(gi); Gi = fftshift(Gi);

subplot(3,3,8);plot(freq,abs(Gi));title('Freq Spectrum of Filter

Demodulated Signal'); subplot(3,3,9); plot(t,gi);title('Demodulated Signal'); %wavplay(g,fs);

Than Lwin Aung

EGR 315

Project 2

Appendix B- Labview Interface and Design  