You are on page 1of 30

Signal processing

London Metropolitan University

Department of Computing, Communication Technology and 

Mathematics 

Broadband Networks

SK. Asif Bari Akash

Assignment: Signal Processing 

Submitted to:

Dr. Bal Virdee

CTP003N

7th December 2006

Sk. Asif Bari Akash-06040876


Signal processing

MSc in Digital Communication Systems

1. Background Study of the Experiment:

1.1 Digital filter:

A digital filter is a filter which operates in digital domain, for example sound
editing in computer. In this process the computer computes a sequence of numbers
which is the input to the digital filter and produces an output which is a new
sequence of number. In this way the filter removes unwanted parts of the signal such
as random noise and extracts useful information.

The block diagram given below is a basic representation of digital filter:

Digital filter
Input signal Output signal

Figure [1]: Block diagram of digital filter


Here, the digital filter block contains the transfer function of the filter. The
transfer function of the digital filter is given below:

( z  1)
H ( z) 
( z  0.5)( z 2  z  0.5)

1.2 Transfer function of digital filter:


The transfer function normally used to analyze a signal input and signal output
of a particular event. The transfer function of digital filter is obtained from the
symmetrical form of the filter expression. This is a convenient and compact way to
express the filter characteristics.

Sk. Asif Bari Akash-06040876


Signal processing

The transfer function of a digital filter is equal to the z transform of the


impulse response of the filter. The transfer function above is a linear time inverient
discrete time filter and contain,

H(z) = Y(z) / X(z)

Here, the numerator Y(z) defined the z transform of the output signal y(n)
and the denominator X(z) denotes the z transform of the filters input signal x(n).

Alternatively, the discrete transfer function can be represented by the equation


below:

num( z ) num0 z n + num1 z n −1 + .... + num m z n −m


h( z ) = =
den( z ) den0 z n + den1 z n −1 +.... + den n

The equation contains m+1 and n+1 number of numerator and denominator.
The co-efficients of equation contained by the num and den operator with descending
power of z.

A stable filter equation must have denominator greater then or equal to the
weighting of the numerator. So, the den must be a vector and num can be a vector
or a scalar component. The discrete transfer function of digital filter sometime
described with the polynomials in Z^-1, which is the delay operator.

1.3 Impulse response of the digital filter:

The impulse response of a digital filter is simply the string of filter co-efficient.
The impulse response of the filter is the output sequence from the filter when a unit
impulse response is applied to its input. Impulse response is very simple input
sequence consisting of a single value of 1 at time, t=0 followed by zeros at all
subsequent sampling instant.

1.4 Sample time:

The time interval between samples of the filter.

Sk. Asif Bari Akash-06040876


Signal processing

1.5 Numerator:

The numerator’s co-efficient which represented in the row vector.

1.6 Denominator:

The denominator’s co-efficient which represented in row vector.

1.7 Zeros and poles of the system:

The zeros represented by the values from the numerator for which the
transfer function equals to zero. Other way the complex frequencies that make the
overall gain of the filter’s transfer function zero.

The poles of the system represented by the values from the denominator for
which the of the transfer function infinite. Other way the complex frequencies that
make the overall gain of the filter’s transfer function infinite.

The poles related to the output side and zeros related to the input side. The
number of poles exist in the system is equal to the number of sampling interval
between the most and least delayed output.

Sk. Asif Bari Akash-06040876


Signal processing

2. Experiment of The Analysis of Filter:


2.1 Part 1:

The transfer function of the digital filter is given below:

( z  1)
H ( z) 
( z  0.5)( z 2  z  0.5)

Form the numerator, the zero of the system could be found. In order to
extract zero, the numerator must be equal to zero.

z  1  0.
So,
or , z  1

So, zero, Z1 = 1

The poles of the system could be extracted form the denominator of the
transfer function. In this case the denominator must be equal to zero.

First pole of the system,

z  0.5  0
or , z  0.5

So, P1 = -0.5.

The poles from the second term can be extracted by using the quadratic
equation, which states that,

2
b  b _ 4ac
x
2a

Sk. Asif Bari Akash-06040876


Signal processing

b 2  4ac
again, >
2a
(1) 2  4.1.0.5
>
2
1 2
or , >
2
or , > 1/ 2

Now, the second pole value,

1  (1) 2  4.1.0.5
P2 
2
1 1 2
or , P 2 
2
1 j
or , P 2 
2
or , P 2  0.5  0.5 j
And, the third pole value,

1  ( 1) 2  4.1.0.5
P3 
2
1 1 2
or , P3 
2
1 j
or , P 2 
2
or , P3  0.5  0.5 j

So, for the given transfer function one zero value and three poles value were
extracted.

Sk. Asif Bari Akash-06040876


Signal processing

2.2 Part 2:

In this part the transfer function was manipulated to express it in the form of
the ratio of two polynomials of z.
The filter transfer function become,
z 1
H ( z) 
( z  0.5)( z 2  z  0.5)
( z  1)
or , H ( z )  3
z  0.5 z  0.25

Hence the co-efficient were deduced from the numerator and denominator
and assigned to the vectors num and den respectively.

num = [0,0,1,-1];
den = [1,-0.5,0,0.25];
2.3 Part 3:

A new m file was opened with suitable header and the two vectors were
declared.

2.4 Part 4:

In this part the poles and zeros of the filter were computed and plotted on the
z-plane. The command tf2zp was used to find the zeros, poles and gains of the filter.

[Z,P,K]=tf2zp(num,den);

The vector den specifies the co-efficient of the denominator and num
indicates the numerator co-efficient. The zero locations are returned in the column of
matrix Z and the poles locations are returned in the column vector P. The gains for
each numerator transfer function returned in vector K.

Sk. Asif Bari Akash-06040876


Signal processing

Since this is a single input and single output system, it is recommended to


make the length of the numerator and denominator of the discrete-time transfer
function equal for correct result. In this case the eqtflength function were used.

[num,den] = eqtflength(num,den)

The poles and zeros of the system were plotted in the z-plane using the function
zplane which return the zeros num and poles den in column vectors with the unit
circle reference.

The plot of the poles and zeros is given below:

0.8

0.6

0.4
Imaginary Part

0.2

­0.2

­0.4

­0.6

­0.8

­1

­1 ­0.5 0 0.5 1
Real Part

Figure [2]: Poles and Zero plot


The zero is represented by ‘0’ marked and the poles are marked with ‘x’.

Sk. Asif Bari Akash-06040876


Signal processing

While making the axis look square the function axis square were used. The plot is
given below:

250

200

150

100

50
Imaginary Part

­50

­100

­150

­200

­250
­1 ­0.5 0 0.5 1
Real Part

Figure [3]: Poles and Zero plot.


Comment:
It was seen that, the computed poles and zeros are same as the plotted poles and
zeros in MATLAB.

Sk. Asif Bari Akash-06040876


Signal processing

2.5 Part 5:

In this part of the experiment the transfer function obtained in part 2 was
expressed in the form below:
L

∑b z k
−k

H (z) = K =0
N
1 + ∑ ak z −k
K =1

To make the first component of the transfer function to 1 and convert all the
indices of the power to negative, the numerator and the denominator were multiplied

by z 3 . The extraction of transfer function in the form is given below:

z 1
H ( z) 
( z  0.5)( z 2  z  0.5)
( z  1)
or , H ( z )  3
z  0.5 z  0.25
z  3.( z  1)
or , H ( z )  3 3
z ( z  0.5 z  0.25)
z 2  z 3
or , H ( z ) 
1  0.5 z 2  0.25 z 3
Hence, the co-efficient of the transfer function were deduced from the
numerator and the denominator.

NUM1 = [0,0,1,-1];
DEN1 = [1,-0.5,0,0.25];

Sk. Asif Bari Akash-06040876


Signal processing

2.6 Part 6:

The filter were declared in terms of NUM1 and DEN1 coefficients and the
frequency response of the filter with magnitude and phase response were obtained.

In this case, the sampling frequency Fs = 8KHz.

The frequency response were computed for nfft= 256 frequency points on the
bandwidth it covers.

In order to obtain the frequency response the freqz function was used.

freqz(NUM1,DEN1,nfft,Fs);

The function freqz return the magnitude and phase response of the digital filter
without any output argument. The plot of the frequency response is given below:

Sk. Asif Bari Akash-06040876


Signal processing

Frequency response of the filter
20

Magnitude (dB) 0

­20

­40
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)

200
Phase (degrees)

­200

­400
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)

Another function used to obtained the magnitude and phase response plot separately
is given below:
[H,F] = freqz(NUM1,DEN1,nfft,Fs);

In this case the function returns the nfft points complex frequency response
vector H and nfft point frequency vector F where Fs is the sampling frequency. It was
found that the bandwidth covered by the filter is 4000Hz.
The magnitude response of the filter is given below:

Sk. Asif Bari Akash-06040876


Signal processing

Magnitude response
5

­5

­10
Magnitude (db)

­15

­20

­25

­30

­35

­40
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)

From the poles/zero diagram, the zero is on the unit circle. So, the magnitude
response of the filter is within the finite range of the bandwidth of the filter. As the
unit circle value goes from 0 to 2Л, the zero must be on the unit circle to ensure the
finite magnitude response of the filter. If the zero value is such that it is located
outside the unit circle, then the magnitude response will be infinite range.

The phase response of the filter is given below:

Sk. Asif Bari Akash-06040876


Signal processing

Phase response
2

­1
Phase degree

­2

­3

­4

­5

­6

­7
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency(Hz)

It can be seen that, the phase response of the filter linearly decreases.

2.7 Part 7:

Sk. Asif Bari Akash-06040876


Signal processing

In this part of the experiment a new transfer function was obtained. The complex
conjugate poles of the system moves closer to the circumference of the unit circle
along 45 degree line and at a distance of 0.95 from the origin.

0.95 45° a

In this case the zero values from the numerator remain the same but the poles
values changes. The poles and zero values are declared using the vector,
NUM2 = [0,0,1,-1];
DEN2 = [1,-0.84,0.2278,.4489];

The calculation for the changed poles values are given below:

P  0.95
e  j  e 45
TransferFunction  Pe  j
 0.95(cos 45  j sin 45)
 0.95(0.707  j 0.707)
 0.67  j 0.67

So, the poles of the system,


p 2  0.67(1  j 0.67)
p3  0.67(1  j 0.67)
The first pole of the system remain unchanged.

So, p1  0.5
Now, the denominator of the transfer function will be,
Deno min ator  ( z  p1).( z  p 2).( z  p3)
Where, p2 and p3 are complex conjugate poles of the system.

Sk. Asif Bari Akash-06040876


Signal processing

So, the addition of the complex poles,


p 2  p3  0.67  j 0.67  0.67  j 0.67
 1.34
The subtraction of complex poles,
p 2  p3  0.67  j 0.67  0.67  j 0.67
 j1.34
The multiplication of the poles,

p 2 xp3  (0.67) 2  ( j 0.67) 2


 2.68

So the denominator,

( z  p1)( z  p 2)( z  p3)  ( z  0.5)( z 2  1.34 z  2.68)


 z 3  0.5 z 2  1.34 z 2  0.67 z  0.8978 z  0.4489
 z 3  0.84 z 2  0.2278 z  0.4489
( z  1)
TransferFunction  3
z  0.84 z  0.2278 z  0.4489
2

z  z 3
2

1  0.84 z 1  0.2278 z 2  0.4489 z 3

2.8 Part 8:

Sk. Asif Bari Akash-06040876


Signal processing

The filter coefficients are declared below:

NUM2 = [0,0,1,-1];
DEN2 = [1,-0.84,0.2278,.4489];

The new filter’s z-plane plot was obtained in terms of its new coefficients. The
plot is given below:

Z­plane plot of number 8

0.8

0.6

0.4
Imaginary Part

0.2

­0.2

­0.4

­0.6

­0.8

­1

­1 ­0.5 0 0.5 1
Real Part

The freqz function were used to get the magnitude and phase response of the
filter and the codes are given below:
freqz(NUM3,DEN3,nfft,Fs);
[H,F] = freqz(NUM3,DEN3,nfft,Fs);

The second argument is used to get the magnitude and phase response in
separate diagram.

The frequency response plot is given below:

Sk. Asif Bari Akash-06040876


Signal processing

Frequency Response of Part 8
20

Magnitude (dB) 0

­20

­40
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)

200
Phase (degrees)

­200

­400
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)

Also the magnitude response and phase response characteristics are given below:

Sk. Asif Bari Akash-06040876


Signal processing

Magnitude response of Part 8
20

10

0
Magnitude (db)

­10

­20

­30

­40
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)

Figure: Magnitude response of the filter in terms of new coefficients.

Phase response of Part 8
2

­1
Phase degree

­2

­3

­4

­5

­6

­7
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency(Hz)

Figure: Phase response of the filter in terms of new coefficients.


2.9 Part 9:

Sk. Asif Bari Akash-06040876


Signal processing

It can be seen that, the filter is acting as a high pass filter with cut-off
frequency of 1KHz in terms of new coefficients. Also, by comparison with the filter’s
frequency responses it was observed that the closer the poles are to the unit circle
the higher the peak of the magnitude response of the new filter.

So, it can be stated that, the frequency response of a filter and the changes in
poles and zero position directly related to each other. An increase in poles or zero in
creases the frequency response of the filter.

2.10 Part 10:


The transfer function of part 7 was modified by replacing the zero at 1 by a

pair of complex conjugate poles at  j . The calculation is given below:

(z  j)
H ( z) 
z  0.84 z  0.2278 z  0.4489
3 2

z 2  z 3
or , H ( z ) 
1  0.84 z 1  0.2278 z 2  0.4489 z 3

2.11 Part 11:

Sk. Asif Bari Akash-06040876


Signal processing

The frequency response plot was obtained for the new transfer function where
the zero was replaced by a complex conjugate poles.
The frequency response plot is given below:

Frequency response of part 11
40

20
Magnitude (dB)

­20

­40
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)

0
Phase (degrees)

­100

­200

­300
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)

Figure: Frequency response with complex conjugate zeros


It can be seen that, the filter responses as a notch filter which combine a low-
pass and a high pas filter.

The separate magnitude and phase response is given below:

Sk. Asif Bari Akash-06040876


Signal processing

Magnitude response of part 11
30

20

10
Magnitude (db)

­10

­20

­30

­40
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency (Hz)

Figure: Magnitude response

Phase response of Part 11
0

­1

­2

­3
Phase degree

­4

­5

­6

­7

­8

­9

­10
0 500 1000 1500 2000 2500 3000 3500 4000
Frequency(Hz)

Figure: phase response


2.12 Part12:

Sk. Asif Bari Akash-06040876


Signal processing

In this part of the experiment the frequency response obtained for part 6, 8
and 11 were compared.
By comparing the three frequency response it can be said that, with the
change of poles and zero the frequency response of the filter changes. If the poles
and zeros of the filter increases so does the magnitude of the frequency response of
the filter.

From the part 6 the filter response comprises of one real zero and two
complex conjugate poles and posses a normal distribution of magnitude and phase
response. And there is no sharp peak in the magnitude response of the filter.

Part 6 2 KHz

Bandwidth

1 KHz 2 KHz 4 KHz

In part 8, the positions of the complex conjugate poles were changed. The
poles were moved along the 45 degree and distance of the 0.95 from the origin. So
the frequency response cut-off frequency will at 1KHz approximately.

2 KHz
Part 8
1KHz Bandwidth

1 KHz 2 KHz 4 KHz

It was also observed from the frequency response plot in part 8.

In part 11 the zeros were replaced by a complex conjugate.

Sk. Asif Bari Akash-06040876


Signal processing

Part 11 2 KHz

Bandwidth

1 KHz 2 KHz 4 KHz

In this case there were two transitions. The magnitude response curve has a
peak at 1KHz but breakdown at 2KHz and increases again up to the bandwidth it
covers, acting as a notch filter.

2.13 Part 13:

Sk. Asif Bari Akash-06040876


Signal processing

In this part the first 20 samples of the unit impulse response of the filter
obtained in part 10 was computed. A stem plot was provided and the horizontal axis
calibrated to represent 8KHz sampling frequency.
The argument used is given below:
[H,T]=impz(NUM3,DEN3,n,Fs);

The argument above computes n sample and scales T so that the samples are
spaced 1/Fs units apart.
The plot of the unit impulse response is given below:

Unit impulse response
1.5

0.5
Magnitude

­0.5

­1

­1.5
0 0.5 1 1.5 2 2.5
Time

Figure: unit impulse responses.

2.14 Part 14 and 15:

Sk. Asif Bari Akash-06040876


Signal processing

In this part of the experiment a signal Sin = [1,2,3,4] is input to the filter. By
convolution the first four values of the output of the filter were deduced.

From the unit impulse response of part 13, we can deduced the first four
values that will be convoluted with Sin.

h(n)=[0,1,0.8,1.5,0.6];

Sin = [1,2,3,4]
So, Convolution C = h(n)  Sin.
The conv function was used to perform the convolution.
C = conv(h, Sin)
Convolves vectors h and Sin. The resulting vector is length
LENGTH(h)+LENGTH(Sin)-1.
From the definition of convolution,
3
C(n) = Σ h(m)* h(n-m)
m=0

By convolving and flipping Sin as mirror,

C (0)  4  0  3  0  2  0  1 0
 0.
C (1)  4  0  3  0  2  0  1 1
 1.
C (2)  4  0  3  1  2  1  1 0.8
 2.8
C (3)  4  0  3  1  2  0.8  1 1.5
 6.1.

The figure below shows the convolution of the signal:

Sk. Asif Bari Akash-06040876


Signal processing

Convolution of the signal
7

4
Magnitude

0
1 1.5 2 2.5 3 3.5 4
Number

Figure: The first four values of the convolution.


Form the figure it can be seen that, the first four values of the convolved
signal matches with the calculation.

3. Appendix 1:

Sk. Asif Bari Akash-06040876


Signal processing

The Matlab code of Experiment 3:


% Experiment 3: Analysis of filter on the basis of poles and zero postion.
%
% Syntax: Experiment3.m
%
% In this experiment a sigital filter was declared in terms of its transfer
% function. The poles and zero position of the filter was obtained and
% plotted in the z-plane. The frequency response of the filter was obtained
% in terms of the poles and zero locations. The frequency reponses were
% compared for different poles and zero locations. The impulse of the
% filter was obtained and a output of the siganl was convoluted with an
% imput signal.
%
% Author: Sk. Asif Bari Akash.
% Date: 02/12/2006.
%
clear;
clc;
close all;
%--------------------------------------------------------------------------
%4. COmputes oles and Zeros of the filter and plot them on the z-plane.
%--------------------------------------------------------------------------
num = [0,0,1,-1];
den = [1,-0.5,0,0.25];
[num,den] = eqtflength(num,den) %make lengths equal.
figure(1);
[Z,P,K]=tf2zp(num,den); % Find poles and Zeros.
zplane (num,den); % Plots poles and zeros.
title('Ploes and Zero diagram');
axis square;
grid on;
%--------------------------------------------------------------------------
%6. Declare the filter in terms co-efficients and obtain frequency response
%--------------------------------------------------------------------------
NUM1 = [0,0,1,-1];
DEN1 = [1,-0.5,0,0.25];
Fs=8000; % Sampling rate.
nfft=256; % Frequency point on the bandwidth
figure(2);
freqz(NUM1,DEN1,nfft,Fs); % Frequency response.
title('Frequency response of the filter part 6');
[H,F] = freqz(NUM1,DEN1,nfft,Fs); % Frequency response.
figure(3);
plot(F,20*log10(abs(H)));%abs function retuns the magnitudes of the response
title('Magnitude response of part 6');
xlabel('Frequency (Hz)');
ylabel('Magnitude (db)');
grid on;
figure(4);
plot(F,unwrap(angle(H))); % angle returns the phase angle in radian.
title('Phase response part 6');
xlabel('Frequency(Hz)');

Sk. Asif Bari Akash-06040876


Signal processing

ylabel('Phase degree');
grid on;
%--------------------------------------------------------------------------
%7. Derive new Trnsfer function when the poles move closer to the circumf-
% rence of the unit circle.
%--------------------------------------------------------------------------
NUM2 = [0,0,1,-1];
DEN2 = [1,-0.84,0.2278,.4489];
[NUM2,DEN2]= eqtflength(NUM2,DEN2);
figure(5);
[Z,P,K] = tf2zp(NUM2,DEN2); % Finds poles and zeros.
zplane(NUM2,DEN2); % Plots poles and zeros.
title('Z-plane plot of number 8');
grid on;
%-------------------------------------------------------------------------
%9. Comparing the magnitudes of the frequency responses of part 6 and 8.
%-------------------------------------------------------------------------
Fs=8000; % Sampling rate.
nfft=256; % Frequency point on the bandwidth.
figure(6);
freqz(NUM2,DEN2,nfft,Fs);
title('Frequency Response of Part 8');
[H,F] = freqz(NUM2,DEN2,nfft,Fs);
figure(7);
plot(F,20*log10(abs(H)));%abs function retuns the magnitudes of the response
title('Magnitude response of Part 8');
xlabel('Frequency (Hz)');
ylabel('Magnitude (db)');
grid on;
figure(8);
plot(F,unwrap(angle(H)));% angle returns the phase angle in radian.
title('Phase response of Part 8');
xlabel('Frequency(Hz)');
ylabel('Phase degree');
grid on;
%--------------------------------------------------------------------------
%10. New transfer function in terms of zero=1 and complex conjugates poles
% at (+-j).
%--------------------------------------------------------------------------
NUM3=[0,1,0,1];
DEN3 = [1,-0.84,0.2278,.4489];
figure(9);
freqz(NUM3,DEN3,nfft,Fs);% Frequency reponse.
title('Frequency response of part 11');
[H,F] = freqz(NUM3,DEN3,nfft,Fs); % Frequency response.
figure(10);
plot(F,20*log10(abs(H)));%abs function retuns the magnitudes of the response
title('Magnitude response of part 11');
xlabel('Frequency (Hz)');
ylabel('Magnitude (db)');
grid on;
figure(11);
plot(F,unwrap(angle(H)));% angle returns the phase angle in radian.

Sk. Asif Bari Akash-06040876


Signal processing

title('Phase response of Part 11');


xlabel('Frequency(Hz)');
ylabel('Phase degree');
grid on;
%--------------------------------------------------------------------------
%13. COmputes the first 20 samples of the unit impulse response.
%--------------------------------------------------------------------------
L=20; %Sample Number
n=0:1:(L-1);
t=n*(1/Fs);
t=t*1000;
figure(12);
[H,T]=impz(NUM3,DEN3,n,Fs); % Impulse response.
T=T*1000;
stem(T,H); % Provide Stem Plot
grid;
xlabel('Time');
ylabel('Magnitude');
title('Unit impulse response');

%--------------------------------------------------------------------------
%14. Convolution of the signal.
%--------------------------------------------------------------------------
h=[0,1,0.8,1.5,0.6];
Sin=[1,2,3,4];
figure(13);
C=conv(h,Sin); % Perform convolution.
stem(C(1:4));
grid on;
xlabel('Number');
ylabel('Magnitude');
title('Convolution of the signal');

%End%
%-------------------------------------------------------------------------%

Sk. Asif Bari Akash-06040876