DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear...

21
CS3291 Exam Jan 2006 solutions 1 02/09/22 /BMGC University of Manchester Department of Computer Science First Semester Year 3 Examination Paper CS3291: Digital Signal Processing Date of Examination: January 2006 Answer THREE questions out of the five given. Time allowed TWO HOURS (Each question is marked out of 20). Electronic calculators may be used. ________________________________________________________________ _____________ 1 (a) Briefly outline four of the main advantages and one disadvantage of digital signal processing (DSP) as opposed to analogue signal processing. [5 marks] (b) Define each of the following terms as applied to discrete time signal processing systems: (i) linearity (ii) time-invariance (iii) causality (iv) stability [4 marks] (c) Produce a signal-flow-graph for each of the following difference-equations (i) y[n] = x[n] + 0.5 x[n-1] 0.5 x[n-2] (ii) y[n] = x[n] + x[n-1] + 0.5 y[n-1] Determine the impulse-response of each of these difference equations. [6 marks] (d) Calculate, by tabulation or otherwise, the output from difference-equation (ii) when the input is the impulse-response of difference-equation (i). [5 marks] 2.

Transcript of DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear...

Page 1: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 1 21/05/23 /BMGCUniversity of Manchester

Department of Computer Science

First Semester Year 3 Examination Paper

CS3291: Digital Signal Processing

Date of Examination: January 2006

Answer THREE questions out of the five given.

Time allowed TWO HOURS

(Each question is marked out of 20). Electronic calculators may be used._____________________________________________________________________________

1 (a) Briefly outline four of the main advantages and one disadvantage of digital signal processing (DSP) as opposed to analogue signal processing. [5 marks]

(b) Define each of the following terms as applied to discrete time signal processing systems:(i) linearity(ii) time-invariance(iii) causality(iv) stability [4 marks]

(c) Produce a signal-flow-graph for each of the following difference-equations(i) y[n] = x[n] + 0.5 x[n-1] 0.5 x[n-2](ii) y[n] = x[n] + x[n-1] + 0.5 y[n-1]

Determine the impulse-response of each of these difference equations. [6 marks]

(d) Calculate, by tabulation or otherwise, the output from difference-equation (ii) when the input is the impulse-response of difference-equation (i). [5 marks]

2.(a) Given the impulse-response {h[n]} of a discrete time LTI system, show that the response to any other input signal {x[n]} is {y[n]} where:

for < n <

Hence express the system function H(z) in terms of {h[n]} for values of z with |z| 1. How is the frequency-response derived from H(z)? [8 marks]

(b) Explain how the poles and zeros of H(z) affect the stability and the gain-response of the system. Give H(z) for a DSP system with the following difference equation: y[n] = x[n] + 1.21x[n-2] - 0.8 y[n-1]Plot its poles and zeros on the z-plane, determine whether it is causal and stable and sketch its gain-response. [9 marks]

(c) If the input signal to a digital filter with frequency-response H(ej) = (1 + 2cos(2) )e –2j

is {x[n]} with x[n] = 2 cos( 0.5 n) for all n, what is the output signal? [3 marks]

Page 2: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 2 21/05/23 /BMGC

3.(a) With the aid of ‘phase-response’ graphs, explain what is meant by the terms 'linearphase' and ‘phase delay’.Explain why having ‘linear phase’ is a desirable property for analogue and digital filters.Is it true that all linear time-invariant DSP systems have linear phase? [5 marks]

(b) Use the windowing method with a rectangular window to design a fourth order "low-pass" FIR digital filter whose cut-off frequency is 2.5 kHz and whose phase-response is ‘linear phase’ in the pass-band. The sampling frequency is 30 kHz.Give the digital filter’s system function. Give a signal-flow-graph for the digital filter.State whether the 4th order FIR digital filter is exactly linear phase or only approximately so.

[8 marks]

(c) Explain how the gain-response of this digital filter could be improved by:(i) increasing the order and(ii) imposing a non-rectangular window?

How would these improvements affect the phase-response? [4 marks]

(d) Why is the Remez exchange algorithm generally considered superior to the windowing method as a design technique for FIR digital filters? [3 marks]

4 (a) Briefly state the advantages and disadvantages of infinite impulse-response (IIR) digital filters as compared with finite impulse-response (FIR) types. [5 marks] (b) A second order IIR “notch” digital filter is required to eliminate an unwanted sinusoidal component of a digitised signal, sampled at 3 kHz, without affecting the magnitudes of other frequency components too severely. The frequency of the unwanted sinusoid is 250 Hz and the 3 dB band-width of the notch should be approximately 38.2 Hz. Design the notch filter by pole and zero placement.Give its transfer function, H(z). Sketch the gain response of the notch filter. [9 marks]

(c) Give a “direct form II” signal flow graph for the notch filter and a program or flow diagram to indicate how the filter would be implemented on a microprocessor with 16-bit integer arithmetic only available. [6 marks]

Page 3: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 3 21/05/23 /BMGC

5 (a) Define the Discrete Fourier Transform (DFT) and explain how it is related to the Discrete Time Fourier Transform (DTFT). [4 marks]

(b) Explain why analogue signals are generally low-pass filtered before they are converted to digital form. With the aid of simple diagrams, explain how aliasing distortion could arise if such filtering were not applied. Explain why increasing the sampling rate simplifies the analogue filters required. [7 marks]

(c) In the absence of an anti-aliasing input filter, what would be the result of sampling an 8 kHz sine-wave at (i) 10 kHz, (ii) 6 kHz and (iii) 4 kHz [3 marks]

(d) Explain the term ‘quantisation noise’ A DSP system, with a 16-bit uniformly quantising analogue-to-digital converter and a sampling rate of 20 kHz, is used to process analogue signals band-limited to the frequency range 0 Hz to 5 kHz. Estimate the maximum achievable signal-to-quantisation noise ratio (SQNR) for sinusoidal input signals, and state what assumptions it is reasonable to make about the statistical and spectral properties of the quantisation noise.

[6 marks]

___________________________________________________________________________

Page 4: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 4 21/05/23 /BMGC

Solutions

1. (a)

Advantages of digital as opposed to analogue signal processing include the following

( choose 4 ) :-

More and more signals are being transmitted and /or stored in digital form so it makes sense to process them in digital form also.

DSP systems can be designed and tested in “simulation ” using universally available computing equipment ( e.g. PCs with sound and vision cards ).

Guaranteed accuracy, as pre-determined by word-length and sampling rate. Perfect reproducibility. Every copy of a DSP system will perform identically. The characteristics of the system will not drift with temperature or ageing. Advantage can be taken of the availability of advanced semiconductor VLSI technology. DSP systems are flexible in that they can be reprogrammed to modify their operation

without changing the hardware. Products can be distributed / sold and updated via Internet. Digital VLSI technology is now so powerful that DSP systems can now perform functions

that would be extremely difficult or impossible in analogue form. Two examples of such functions are :(i) adaptive filtering ( where the parameters of a digital filter are variable and must be adapted to the characteristics of the input signal) and, (ii) speech recognition which is again based on information obtained from speech by digital filtering.

Disadvantages of digital signal processing ( choose one ) : DSP designs can be expensive especially for high bandwidth signals where fast

analogue/digital conversion is required. The design of DSP systems can be extremely time-consuming and a highly complex and

specialized activity. There is an acute shortage of electrical engineering graduates with the knowledge and skill required.

The power requirements for DSP devices can be high, thus making them unsuitable for battery powered portable devices such as mobile telephones. Fixed point processing devices ( offering integer arithmetic only ) are available which are simpler than floating point devices and less power consuming. However the ability to program such devices is a particularly valued and difficult skill.

1(b)

Linearity:-Given any two discrete time signals {x 1 [n]} and {x 2 [n]}, if the system's response to {x 1 [n]} is {y 1 [n]} and its response to {x 2 [n]} is {y 2 [n]} then for any values of the constants k 1 and k 2 , its response to k 1{x 1[n]} + k 2{x 2[n]} must be k 1{y1[n]} + k 2 {y 2 [n]} . To multiply a sequence by k, multiply each element by k. To add two sequences, add corresponding samples.

Time invariance:-Given any discrete time signal {x[n]}, if the system's response to {x[n]} is {y[n]}, its response to {x[n-N]} must be {y[n-N]} for any integer N. (Delaying the input signal by N samples must delay the output signal by N samples.)

Causality: If the impulse response is {h[n]} then h[n] = 0 for n< 0 if the system is causal.

Stability:

Page 5: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 5 21/05/23 /BMGC(c) SFGs

(i) {h[n]} = { …, 0…, 0, 1, 0.5, -0.5, 0, …, 0, …}

(ii) {h[n]} = {…, 0, …, 0, 1, 1.5, 0.75, 0.375, 0.1875, ….. }

(d) By tabulation:

n x[n] x[n-1] y[n-1] y[n]

-1 0 0 0 0

0 1 0 0 1

1 0.5 1 1 2

2 -0.5 0.5 2 1

3 0 -0.5 1 0

4 0 0 0 0

5 etc.

{h[n]} = { …, 0, 1, 2, 1, 0, ….., 0 }

By ‘otherwise’: For (i) system function is H1(z) = 1 + 0.5 z-1 - 0.5 z-2 = (1 - 0.5z-1)(1+z-1) For (ii) H2(z) = (1+z-1)/(1-0.5z-1) Tranfser fn of (i) & (ii) is H1(z)H2(z) = (1 - 0.5z-1)(1+z-1)(1+z-1)/(1-0.5z-1) = (1+z-1)(1+z-1) = 1 + 2z-1 + z-2

Impulse response of H1(z) H2(z) = {…, 0, , 0, 1, 2, 1, 0, …, 0, …)

z-1 z-1

+ +

x[n]

y[n]

-0.50.5

+

z-1

0.5

{y[n]}{x[n]}

z-1

Page 6: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 6 21/05/23 /BMGC

2(a) Response to impulse {d[n]} is {h[n]} Response to {d[n-k]} is {{h[n-k]} by time-invariance Response to x[k] {d[n-k]} is x[k]{d[n-k]} by linearity, taking x[k] as a constant

Now

Now let m = n-k. When k = then m=-. When k = - then m=.It follows that:

(It doesn’t matter what order you add things up in.)

If we set x[n] = zn for all n, where z is a complex number with |z| 1 then

H(z) is the system function.Replacing z by ej gives the ‘frequency-response’ as a function of relative frequency in radians per sample.

2(b)Zeros do not affect stability.

Poles must lie inside unit circle for stability.

Gain response determined by the "distance rule":-

Gain at frequency is:

Product of distances from each zero to the point z = e j on unit circle

G() =

Product of distances from each pole to the point z = e j on unit circle

y[n]=x[n]+1.21x[n-2]-0.8y[n-1]

Zeroes at z = -1.1j and z = +1.1j Poles at z = 0 and z = -0.8

Filter is causal as impulse response will be zero for n<0.

Filter is stable as poles are inside unit circle.Imag(z)

Page 7: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 7 21/05/23 /BMGC

To sketch gain response from pole-zero diagram:

Prod zero distances Prod pole distances Gain estimate

0 1.5 * 1.5 1 * 1.8 1.25

/4 0.6 * 1.5 1 * 1.5 0.6

/2 0.1 * 2.1 1 * 0.8 0.26

3/4 0.6 * 1.5 1 * 0.5 1.8 1.5 * 1.5 1 * 0.2 11.25

3 dB points : Assuming negligible changes to pole distances and distance to zero at z = -1.1j,

the gain may be estimated to increase by 3 dB at = /2 0.1 from its value at = /2. This is

because the zero is at a distance 0.1 from the unit circle.

Similarly gain may be estimated to fall by 3dB at = -0.2 radians per sample because the pole

is also at distance 0.2 from the unit circle.

Hence sketch gain response:

Real(z)

Zero at z=1.1j

Zero at z=-1.1j

Pole

Pole0.8

G()10

Page 8: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 8 21/05/23 /BMGC2(c)

Response is {2 G() cos(0.5n + ()} with = 0.5

G() = (1+2cos(2)) and ()=-2

Response is 2(1+2cos(1))cos(0.5 n - 1) } = 2(2.08)cos(0.5 n - 1) }

i.e. {4.16 cos(0.5n - 1) }

Page 9: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 9 21/05/23 /BMGC

3(a) Expressing the frequency-response H(ej) = G()exp(j()), a digital filter with phase response () is linear phase if the phase-delay () / is constant for all . A linear phase response graph is as follows:

Similarly for an analogue filter with replacing ..Linear phase is a desirable property because then the system delays all frequency components of a periodic signal (say), expressed as a Fourier series say, by exactly the same amount of time. If there are no amplitude changes, say because the signal falls within the pass-band of a low-pass digital filter, the output waveform will not be distorted in shape by phase effects (different frequency components being delayed by different amounts of time and therefore adding up differently). All frequency components of a signal will be delayed by the same amount of time, i.e. the phase delay. Hence ‘phase distortion’ will not occur.It is not true to say that all LTI systems have linear phase.

3 (b) With fs = 30 kHz and cut-off = 2.5 kHz,

the relative cut-off frequency C = (2 / fs ).2500 = /6 radians per sample.

Take phase to be zero initially.

Therefore H(ej) = G()

By the inverse DTFT formula:

h[n] =

=

The impulse response is {h[n]} with

h[n] = (1/(n)) sin(n/6) when n 0

and h[n] = 0.1667 when n=0.

______________________________

n h[n]0 0.16671 0.1602 0.138

3 0.106 etc______________________________

()

Page 10: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 10 21/05/23 /BMGCOn rectangularly windowing, we obtain the causal finite impulse response:

{h[n]} = { …0, 0.138, 0.16, 0.1667, 0.16 0.138, 0, …, 0, …}

After delaying by 2 samples to make the impulse response causal,

{h[n]} = { …0, 0, 0.138, 0.16, 0.1667, 0.16, .138, 0, …, 0, …}

H(z) = 0.138 + 0.16z-1 + 0.1667 z-2 + 0.16 z-3 + 0.138z-4

Signal-flow graph

Filter is now linear phase with phase delay of 2 sampling intervals (in the pass-band) .

It will have a well defined stop-band decreasing in gain from 0dB at 0 Hz to -6 dB at the cut-off

frequency. The stop-band gain will have ripples (illustration useful).

3(c)Increasing the order of the filter would mean that the phase delay would have to increase

also if the filter remains linear phase. The magnitude response would become closer to the

ideal low-pass response with more stop-band ripples. If the rectangular window is still used, the

highest stop-band ripple would not reduce significantly due to Gibb's Phenomenon.

The use of a Hann or similar raised cosine window would reduce the stop-band ripples at the

expense of a less sharp cut-off rate from pass-band to stop-band.

The phase response is not affected by the imposition of a non-rectangular window.

3 (d) The Remez exchange algorithm gives an 'equi-ripple approximation' to the ideal gain response required; i.e. equal ripple peaks across pass-band and stop-band. [1] With the windowing technique, the peaks of the stop-band ripples are not equal in amplitude and reduce with increasing frequency. The stop-band approximation gets better with increasing frequency . [1] By making all ripple peaks equal, Remez minimises the difference between the ideal gain response and the approximation across the whole of the frequency range. It is a 'mini-max' approximation. Hence the highest stop-band ripple peak will be lower than for the windowing technique. [1]

Page 11: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 11 21/05/23 /BMGC

4. (a) Comparison of IIR and FIR digital filters:

IIR type digital filters have the advantage of being economical in their use of delays, multipliers and adders. [1]They have the disadvantage of being sensitive to coefficient round-off inaccuracies and the effects of overflow in fixed point arithmetic. These effects can lead to instability or serious distortion. [1]Also, an IIR filter cannot be exactly linear phase. [1]

FIR type digital filters may be realised by non-recursive structures which are simpler and more convenient for programming especially on devices specifically designed for digital signal processing. These structures are always stable, and because there is no recursion, round-off and overflow errors are easily controlled. A FIR filter can be exactly linear phase. [1]The main disadvantage of FIR filters is that large orders can be required to perform fairly simple filtering tasks. [1]

4. (b) fs = 3000 Hz. Notch is at 250 Hz

Rel frequency of notch = (2/3000).250 = / 6 radians/sample.

3dB bandwidth = 38.2 Hz

= 38.2 / 3000 x 2 = 0.08 radians/sample

Therefore 3 dB points are at / 6 0.04 radians/sample.

Poles must be placed at 0.04 from the unit circle

Distance from zeros on unit circle = 0.04

Place zeros z1 and z2 at exp( j /4).

Place poles p1 and p2 at 0.96 exp( j /4)

(z - e j / 4) (z - e - j / 4)H(z) = (z - 0.96 e j / 4) (z - 0.96 e - j / 4)

z2 - 2 cos (/4) z + 1 = z2 - 1.92 cos ( / 4) z + 0.96 2

z2 - 1.414 z + 1H(z) = z2 - 1.92 z + 0.922

1 - 1.414 z - 1 + z - 2

H(z) = 1 - 1.92 z - 1 + 0.922 z - 2

Page 12: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 12 21/05/23 /BMGC4(b) continued

Difference equation is:

y[n] = x[n] - 1.414 x[n-1] + x[n-2] + 1.92 y[n-1] - 0.922 y[n-2]

Sketch gain response.

4 (c) Signal flow graph:

1

G()

0.7

/6 /6+0.04/6-0.04

0 dB

-3 dB

Page 13: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 13 21/05/23 /BMGC

4(c) continued

% Direct Form II in fixed point arithmetic & shifting.

K=1024; A0=K; A1=round(-1.414*K); A2=K; B1=round(-1.92*K); B2=round(0.922*K); W1 = 0; W2 = 0; %For delay boxes while 1 Input X ; %Input a sample W =K*X - B1*W1 - B2*W2; % Recursive part W =round( W / K); % By arith shift

Y = W*A0+W1*A1+W2*A2; % Non-rec. part W2 = W1; W1 = W; %For next time Y = round(Y/K); %By arith shift Output Y; end; %Back for next sample

Page 14: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 14 21/05/23 /BMGC

5.(a) Considering first the DTFT formula:

X(ej) =

This transforms a (possibly complex) discrete time signal {x[n]} of infinite duration to the

relative frequency () domain.

Defining: , the DFT transforms a finite (possibly complex valued) sequence

{x[n]}0,N-1 to the finite complex valued sequence {X[k]}0,N-1.

The DFT formula is:-

For each k = 0,1, 2, …, N-1, X[k] is a sample of the spectrum X(e j) at =2k/N. In this case,

X(ej) is the spectrum (DTFT) of an infinite discrete time signal {x[n]} comprising {x[n]}0,N-1

padded out to infinity (in both directions) with zeros.

Therefore is in the range 0 to 2 is and X(ej) is uniformly sampled over this range.

5 (b) The DTFT of {x[n]} obtained by sampling xa(t) at intervals of T seconds is :

If xa( t ) is band-limited between -/T and +/T radians/sec ( fs/2 Hz ), then Xa( j ) =0 for /T. It follows that : X( ejT ) = ( 1/T ) Xa( j ) for -/T < < /T This is because Xa( j( - 2/T ) ), Xa( j( + 2/T ) ) and Xa( j ) do not overlap. Where Xa(j) is not band-limited to the frequency range -/T to /T, overlap occurs. If now we take Xs( ejT ) to represent Xa( j )/T for -/T < < /T, it will be distorted. This is aliasing distortion. To avoid aliasing distortion, low-pass filter xa( t ) to band-limit the signal to fS/2 Hz before sampling at fs Hz. It then satisfies “ Nyquist sampling criterion ”.

5 (c) (i) We obtain an aliased sine wave of frequency 5 -3 kHz = 2 kHz (ii) we obtain aliased sine wave of frequency 2 kHz (iii) A constant (dc) signal seen. No sine wave at all.

5 (d) Quantisation noise power : 2/12 where is quantisation step.

Page 15: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 15 21/05/23 /BMGCSinusoidal signal power = A2 / 2 where A is the maximum possible signal amplitude.16- bit ADC, therefore 216 quantisation levels. A = 2 15

Signal-to-quantisation noise ratio (SQNR) = (A2/2) / (2 / 2) = 2 29 2 / (2 /12) = 2 31 x 3 = 25.166 x 10 6

In dB SQNR = 10 log10(2 31 x 3) = 97.7 dB ( = 6 x 16 + 1.7)

The quantisation noise spectrum may be assumed white in the frequency range 0 to fs / 2 Hz.In the time-domain, the quantisation error samples may be assumed random and statistically uniformly distributed between -/2 and /2.

Page 16: DSP EXAM 2006barry/mydocs/COMP30291/Solutions…  · Web viewIs it true that all linear time-invariant DSP systems have linear phase? [5 marks] (b) Use the windowing method with

CS3291 Exam Jan 2006 solutions 16 21/05/23 /BMGC