Sei sulla pagina 1di 4

Simulation exercises using MATLAB/SIMULINK

B. FREQUENCY DOMAIN REPRESENTATION OF LTI


SYSTEMS
Objective: i. Representation of discrete-time systems using z-Transforms
ii. Frequency domain representation of discrete-time signals – DFS, DTFT,
DFT

To enter a transfer function

% Z – domain
% H(z) = (1-5z^(-1)+6z^(-2))/(1+1.25z^(-1)+0.375z^(-2))
b2 = [1 –5 6]; a2 = [1 1.25 0.375];
printsys(b2,a2,’z’);

• Transfer function to zero-pole conversion (tf2zp)


[z,p,k] = tf2zp(b2,a2)

• To obtain the pole-zero map


zplane(b2,a2);
title(‘ Pole- zero plot of H(z) ‘)

• To find the Partial Fractions of the Transfer function


[r,p,k] = residuez(b2,a2)

1. Transform the system described by y[n]-0.3695y[n-1]+0.1958y[n-2] = 0.2066 x[n]


+0.4131x[n-1] +0.2066x[n-2] to zero-pole form and residue form. Plot pole-zero map
and comment on stability.
z −1 + 0.5z −2
2. Compute the causal inverse of H ( z ) =
1 − 0.6z −1 +.08z − 2

3. For the LTI systems described by the following difference equations, generate its
frequency response. Comment on the type of response.
y[n]-0.3695y[n-1]+0.1958y[n-2]=0.2066x[n]+0.4131x[n-1] +0.2066x[n-2]
Sample Solution Frequency response
0
Magnitude Response (dB)

-20
% ex2_3.m
% Frequency domain response of -40

difference equations -60

% y[n]–0.3695y[n-1]+0.1958y[n-2] = -80

0.2066x[n]+0.4131x[n-1]+0.2066x[n-2] 0 0.1 0.2 0.3 0.4 0.5 0.6


Normalized frequency (Nyquist == 1)
0.7 0.8 0.9 1

b1 = [0.2066 0.4131 0.2066];


-50
a1 = [1 –0.3695 0.1958];
Phase (degrees)

freqz(b1,a1,64); -100

title(‘ Frequency response’) -150

-200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized frequency (Nyquist == 1)

Dept. of E&C, NITK Surathkal 8


Simulation exercises using MATLAB/SIMULINK

4. Run the following demos.


a) Fourier analysis of standard signals (sine,square etc)
cd d:\dsp_lab\demo\module3
gui

b) DTFT of standard signals


cd d:\dsp_lab\demo\module6\simp_dtft
gui

c) DTFT of audio signals


cd d:\dsp_lab\demo\module6\comp_dtft
gui

Select any audio signal available in d:\dsp_lab\demo\sound\wav_files as *.mat file.

5. Compute and plot the DTFT of the following sequence and observe the properties
s[n]= A cos(2πf0n + φ) Try for fo=100Hz, φ=π/6 and different lengths of sequence.

6. Run the following demo


Effect of poles and zeros on the z plane

cd d:\dsp_lab\demo\pez_31
pez

Observe the relation between location of poles and zeroes in z plane, impulse response
and frequency response for the following systems

i y(n) = 0.77y(n-1)+x(n)+x(n-1)
ii y(n) = 0.77y(n-1)+0.77x(n)-x(n-1)
iii H(z) = 1-z-1/1+0.77z-1
iv H(z) = 1-z-1+z-2-z-3+z-4-z-5
v y(n) = x(n)+x(n-1)+x(n-2)+x(n-3)+x(n-4)+x(n-5)
vi H(z)=3-3z-1

7. Compute and plot the magnitude, phase and group delay for the following DTFT and
observe the properties

i. H(ejω) = (1 + rejθ e-jω) ; r=0.9, θ = 0, π/2, π


ii. H(ejω) = 1/(1 + rejθ e-jω) ; r=0.9, θ = 0, π/2, π
iii. H(ejω) = (1 + rejθ e-jω) ; r=1, 0.5, 0.7, 0.9, θ = π
iv. H(ejω) =1/ (1 + rejθ e-jω) ; r=1, 0.5, 0.7, 0.9, θ = π
v. H(ejω) = (1 + rejθ e-jω) ; r=1/0.9, 1.25, 2, π
vi. H(ejω) = 1/(1 + rejθ e-jω)(1 + re-jθ e-jω); r=0.9, θ = π/4
vii. H(ejω) = (1 + rejθ e-jω)(1 + re-jθ e-jω); r=0.9, θ = π/4
viii. H(ejω) = (e-jω - re-jθ )/(1- rejθ e-jω); r=0.9, θ = 0; r=0.9, θ = π; r=0.9, θ = π/4;

8. Consider an IIR filter described by y(n)-0.8y(n-1)=x(n). Find the impulse response h(n).
(i) Truncate h(n) to three terms and obtain h3(n). Plot the DTFT of h(n) and h3(n). (ii)
Truncate h(n) to ten terms and obtain h10(n). Plot the DTFT of h(n) and h10(n). (iii). If
the same input is applied to both the original filter and the truncated filter, will the

Dept. of E&C, NITK Surathkal 9


Simulation exercises using MATLAB/SIMULINK

greatest mismatch in the response y(n) of the two filters occur at earlier or later time
instants n?

9. Consider the following averaging filters


1 N −1
i. y ( n) = ∑ x ( n − k ) N point moving average
N k =0
N −1
2
ii. y ( n) = ∑ ( N − k ) x(n − k )
N ( N + 1) k =0
N point weighted average

N −1
iii. y (n) − α y (n − 1) = (1 − α ) x(n), α = first order exponential average
N +1
(a) Sketch the frequency response of each filter with N=4 and N=9. How will the
choice of N affect the averaging?
(b) Generate the signal x(n)=1 – 0.6n; 0≤n≤299, add some noise and apply the noisy
signal to each averager and compare the results.

10. Digital filters are used to compensate for the sinc distortion of a ZOH DAC by
providing 1/sinc(ω) boost. Two such filters are (i) y(n)=[x(n)-18x(n-1)+x(n-2)]/16 and
(ii) y(n)+0.125 y(n-1)=1.125 x(n). For each filter state whether it is FIR (and if so
linear phase) or IIR. Plot the frequency response of each filter and compare with
|1/sinc(ω)| function. Over what digital frequency range does each filter provide the
required sinc boost?

11. Let x(n)=cos(0.2nπ) + 0.5 cos(0.4nπ); 0≤ n ≤ 99.


(i) Plot the spectrum of this signal.
(ii) Generate zero interpolated signal y(n)=x(n/2) and plot its spectrum. Comment on
your observations.
(iii) Generate the decimated signal d(n)=x(2n) and plot the spectrum. Comment on
your observations.
(iv) Generate the decimated signal d(n)=x(3n) and plot the spectrum. Comment on
your observations.

12. The impulse response of filters for step interpolation, linear interpolation and ideal
(sinc) interpolation by N are given by
hS(n) = u(n)-u(n-(N-1))
⎧ |n|
⎛ n ⎞ ⎪1 − | n |≤ N
hL(n) = tri(n/N) where tri ⎜ ⎟ = ⎨ N
⎝ N ⎠ ⎪0
⎩ elsewhere
sin(nπ / N )
hI(n)=sinc(n/N) where sinc(n/N)= , sinc(0)=1
(nπ / N )
Plot the frequency response of each interpolating function for N=4 and N=8. How
does the response of step interpolation and linear interpolation schemes compare with
ideal interpolation.

13. To interpolate a signal x(n) by N, we use an upsampler (that places N-1 zeros after
each sample) followed by a filter that performs the appropriate interpolation. Generate
a test signal x(n)=cos(0.5πn) 0≤ n ≤ 3. Upsample this by N=8 to obtain xU(n).

Dept. of E&C, NITK Surathkal 10


Simulation exercises using MATLAB/SIMULINK

(i) Use the step interpolation filter hS(n) to obtain xS(n). Plot xU(n) and xS(n) on the same
plot. Does it look like a sine wave
(ii) Use the step interpolation filter hS(n) followed by a compensating filter y(n)=[x(n)-
18x(n-1)+x(n-2)]/16 to obtain xC(n). Plot xU(n) and xC(n) on the same plot. Does it
look like a sine wave. Is there any improvement?
(iii) Use the linear interpolation filter hL(n) to obtain xL(n). Plot xU(n) and a delayed (by
8) version of xL(n) on the same plot. Does it look like a sine wave.
(iv) Use the ideal interpolation filter hI(n)= sinc(n/N) |n| ≤ M to obtain xI(n) (with
M=4,8,16). Plot xU(n) and a delayed (by M) version of xI(n) on the same plot. Does it
look like a sine wave. What is effect of increasing M?

14. A 18.75 Hz sinusoid is contaminated by 50Hz interference. We wish to sample this


signal and design a causal 3 point linear phase FIR filter operating at a sampling
frequency of FS=150Hz to eliminate the interference and pass the desired signal with
unit gain. Show that a filter with impulse response h(n)=[α, β, α] can be used. Choose
α and β to satisfy the design requirements. Test the filter by generating 100 samples
of the input noisy signal.

Dept. of E&C, NITK Surathkal 11

Potrebbero piacerti anche