january 9, 2017 · reals). that is, the function's domain is an uncountable set. the function...

41
ID: s09466807 DIGITAL SIGNAL PROCESSING Analytical Principles of DSP and Digital Filter Design PRESENTED TO JAGJIT SEHRA BY ZEESHAN MUSTAFA LATIF ANSARI BEng (Hons) Electronics Engineering JANUARY 9, 2017

Upload: others

Post on 11-Oct-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807

DIGITAL SIGNAL PROCESSING Analytical Principles of DSP and Digital Filter Design

PRESENTED TO JAGJIT SEHRA

BY ZEESHAN MUSTAFA LATIF ANSARI BEng (Hons) Electronics Engineering

JANUARY 9, 2017

Page 2: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 2

Contents Page Numbers

Introduction…………………………………………………………………………………………………3

Background………………………………………………………………………………………………….3

Part a – Analytical Problems…………………………………………………………………………7

Question 1, Part (i)………………………………………………………..……………………………….…………7

Question 1, Part (ii)…………..………………………………………………………………………………………8

Question 1, Part (iii)………………………….…………………………………………………………………….10

Question 1, Part (iv)………………………………………………………………………………………………..13

Proof of results obtained in Q1 (ii) by using a suitable m-file………………….…..13

Proof of results obtained in Q1 (iii) by using a suitable m-file………………..……20

Question 2, Part (i)………………………………………………………………………………………………….22

Question 2, Part (ii)…………………………………………………………………………………………………23

Question 2, Part (iii)………………………………………………………………………………………………..24

Question 3, Part (i)………………………………………………………………………………………………….26

Question 3, Part (ii)…………………………………………………………………………………………………27

Question 3, Part (iii)………………………………………………………………………………………………..28

Part b – Digital Filter Design using MATLAB and SPTOOL…………………………….29

Question 4, Part (i)………………………………………………………………………………………………….29

Question 4, Part (ii)…………………………………………………………………………………………………32

Designing LOW-PASS FIR Filter for Noisy Signal…………………………………..……….33

Designing LOW-PASS IIR Filter for Noisy Signal……………………………………….…..35

Question 4, Part (iii)………………………………………………………………………………………………..36

Conclusion………………………………………………………………………………………………….39

References………………………………………………………………………………………………….40

Bibliography……………………………………………………………………………………………….41

Page 3: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 3

Analytical Principles of DSP and Digital Filter Design

Introduction

The world of science and engineering is filled with signals. DSP refers to various

techniques for improving the accuracy and reliability of digital communications.

Signal processing is the science of understanding the formation of information

conveyed as a function of time, space or any other variable. Analysing this

information requires the acquisition, storage, transmission and transformation of

signals. Signals can be classified as continuous or analogue, such as speech or

discrete, in the form of digital information. Basically DSP works by clarifying, or

standardizing, the levels or states of a digital signal. It is the process of analysing or

modifying a signal to optimize or improve its efficiency or performance (Sehra, 2017).

As per the title states the assessment is undertaken to analyse and observe the

functionalities and complex behaviours of FIR and IIR filters using Matlab software.

In order to complete this assignment, detailed fundamental knowledge of DSP was

acquired including its mathematical techniques for solving equations to design the

digital filters. Based on the knowledge and skills acquired in Signals and Systems

and further in this (DSP) module work was initiated with solving and verifying the

equations given in assessment brief. Following which the required data and results

obtained were implemented into Matlab to analyse, observe and design the digital

filters. Lastly, theoretical values and results calculated were compared with the

values and results which were obtained in Matlab by using suitable program code

and relevant software skills.

Assessment is comprised of two parts; Part A being the “Analytical problems” had to

be solved using various mathematical techniques, learnt throughout the module,

then they were plotted and analysed in Matlab. Part B being the “Digital Filter Design

using MATLAB and SPTOOL” involved designing and filtering the signals. This

involved the design of a noisy guitar signal and development of code (m-file) to

reduce or totally remove the un-wanted noise from it to produce a clean signal which

was also verified by listening both the signals. This section also specifies the design

requirement if a real-time system was to be employed. It ends with discussion on two

current DSP developments kits (available in UK) for audio processing.

Background

In the world of communications circuits it is true whether the signals are analogue or

digital they always contain some level of noise. Noise is said to be the eternal bane

of communications engineers who are always striving to find new ways to improve

signal-to-noise ratio. For this assessment it‟s important to explain the difference

Page 4: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 4

between continuous-time, discrete-time and digital signals so that further work can

be started (WhatIs.com, 2017).

A continuous signal or a continuous-time signal is a varying quantity (a signal)

whose domain, which is often time, is a continuum (e.g., a connected interval of the

reals). That is, the function's domain is an uncountable set. The function itself need

not be continuous. On the other hand, a discrete time signal has a countable

domain, like the natural numbers.

A signal of continuous amplitude and time is known as a continuous-time signal or an analogue signal. This (a signal) will have some value at every instant of time. The electrical signals derived in proportion with the physical quantities such as temperature, pressure, sound etc. are generally continuous signals. Other examples of continuous signals are sine wave, cosine wave, triangular wave etc.

Figure 1 shows a typical continuous time signal, function ( ) for the word “signal”.

This is a mathematical representation of the signal as a function of time, t, which is

refered to as the independent variable.

Figure 1 continuous time signal, taken from DSP Moodle

Discrete-time signals can be considered, as digital signals, where the value of the

signal is known at discrete time intervals. All that is known about the signal is a

sequence of values. Both the amplitudes and time can be quantized. In other words,

the digital value can only take a specified value with a specific range. This will

depend on the quality of the conversion process of the A/D.

A digital signal refers to an electrical signal that is converted into a pattern of bits.

Unlike an analogue signal, which is a continuous signal that contains time-varying

quantities, a digital signal has a discrete value at each sampling point. Digital signals

are discrete time signals generated by digital modulation, computers, CDs, DVDs,

and other digital electronic devices (Sehra, 2017).

Difference between analogue and digital signal processing

The basic difference between analogue and digital signal processing is that

analogue signal is a continuous signal which represents physical measurements

while digital signals are discrete time signals generated by digital modulation. Analog

Page 5: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 5

waves are smooth and continuous while digital waves are stepping, square and

discrete. We can have a model of a system, in the context of signal processing.

Consider the block diagrams shown in figure 2.

Figure 2 a) Analogue recording system b) Digital recording system, taken from DSP Moodle

Discrete-time signals can be considered, as digital signals, where the value of the

signal is known at discrete time intervals. All that is known about the signal is a

sequence of values. Both the amplitudes and time can be quantized. In other words,

the digital value can only take a specified value with a specific range. This will

depend on the quality of the conversion process of the A/D. Figure 3 shows simply

the process of A/D and D/A.

Figure 3 A/D process, taken from DSP Moodle

It should be pointed out that in order to process analogue signals they must be

processed first, that is consider a physical quantity, such as sound signal, it must be

first captured using some form of transducer or sensor before it can be processed. It

must be conditioned, to remove any un-wanted signal information, through filtering.

Once this is complete the analogue to digital process can be done, and the signal

can be manipulated, before it is re-converted back to an analogue form, using an

anti-aliasing filter, sometimes referred as a low pass filter, to remove the stair case

effect of the DAC. Figure 4 below shows a block diagram of an ideal system for

processing continuous time signal (Sehra, 2017).

Page 6: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 6

Figure 4 Block diagram for processing continuous time signal, Taken from DSP Moodle

The Advantages of DSP

1. It‟s cost effective. Many development kits are available at low cost as well as

of industrial standard.

2. DSP systems can be designed and tested in a simulation using software

tools, which in many cases can guarantee accuracy of systems.

3. Complex processing of information which is difficult or sometimes impossible

in the analogue domain can be accomplished by digital signal processing.

Examples are adaptive filtering, where the digital filter can vary or adapt its

performance to the characteristics of the signal; another is speech analysis

and processing.

4. It‟s reliable and compact.

5. DSP systems will work the same, performance can be enhanced depending

on the evolution of the hardware/software.

6. Multi-processing of information is achieved by DSP.

Disadvantages of DSP

1. DSP is software driven process, up-dates to systems can only be done by re-

programming for example software driven radio.

2. System performance can be reduced. Due to an analogue to digital

conversion, there are bandwidth requirements, which can lead to loss or

quality of information

3. For „real-time‟ applications, it requires a good understanding of mathematical

techniques to fully implement systems to chip (Sehra, 2017).

Applications of DSP

Real time applications of DSP are Audio and multimedia, speech processing and

recognition, image and video processing, Telecommunications, Computer systems

and military systems.

Page 7: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 7

Part a - Analytical Problems

Causal systems are those that can be implemented in real hardware also called

realisable systems. A “Function” can be a linear but it cannot necessarily be a linear

system. To be a linear system it must be conforming to homogeneity and

superposition. Homogeneity is when the input is multiplied by a constant; the output

is also multiplied by the same constant. Superposition is when the input sequences

of two functions are added, their outputs also are added. A time invariant system is a

system whose output does not depend explicitly on time, it‟s independent of time

(Sehra, 2016).

Question 1, Part (i): A causal Linear Time Invariant (LTI) System is given by the function H (Z) below:

( )

(

) (

)

( ) ( ) ( )

Determining the Ideal Nyquist Rate of the above input signal (𝐹 ):

For Ω = 40π

As Ω = 2πf

40π = 2πf

⇒ 20 Hz

For Ω = 80π

As Ω = 2πf

80π = 2πf

⇒ 40 Hz

Page 8: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 8

Nyquist frequency is twice the maximum component frequency of the function being

sampled.

So Nyquist rate = 2 x 40 = 80 Hz

In other words, in order to retain data it is always sampled at twice the highest

frequency.

( ) ( ) ( )

( ) (

) (

)

( ) (

) + 9cos (πn)

As found above = 0, =

and = π

Question 1, Part (ii):

Transfer Function Y (Z) = ∑ [ ]

H (Z) =

(

)(

)

where is Unit delay.

=

=

( (

))

=

(

)

=

(

)

=

So frequency response ( ) = ∑ [ ] which is Gain of System.

H ( ) =

=

Where = Euler‟s Method = 𝜃 ± 𝑗 𝑖 𝜃

Page 9: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 9

As = cosө jsinө

When ω = 0

Using Euler‟s Method

H (0) =

( )

( ( )( )) ( ( )( ))

=

( ( ))

( ( ))

=

H ( ) =

= 5.88 ⇒ approximately 6.

When ω =

Using Euler‟s Method

H (

) =

( (

) (

))

( (

)( ) (

)( ))

=

( )

( )

Here, the identity used is

𝑗

=

=

( )

=

Here, the identity used is

𝑗

Then we use √ 𝑗 = a + jb which is the magnitude formula in order to get rid of

the complex number.

Therefore, H (

) = √ 𝑗 ⇒

√ ⇒ 3.394

H (

) = 3.394

Then in order to find the phase, the formula Ө =

is applied, hence;

Page 10: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 10

Ө =

When ω = π

Using Euler‟s Method

H (ω) =

=

( )

( ( ) ( ) ( ) ( ))

=

( )

( )

=

( ) ( ) ⇒

⇒ 4

H ( ) = 4

To determine the ( ) output, all the values of “Gain” and “Phase angles” are

applied to the original equation given below:-

[ ] H ( ) [ ]

[ ] = 10 + (

) ( )

Calculated “Gains” are multiplied to the “Gains” of the system and then “Phase

differences” are found by subtracting the found phases from the relevant system

phases as shown below:

[ ] = 6 x 10 + 3.394 x 5cos(

) + 4x9( )

[ ] = 60 + 16.97cos(

) + 36( )

For ω = 0 and ω = π, there are no phase angles so there is no phase difference.

Question 1, Part (iii): To design the filters, first we need poles and zeroes:-

H (Z) =

(

)(

)

1

= 0

Page 11: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 11

=

=

=

Z =

=

Also 1 +

= 0

=

=

1 × 1 =

Z =

Filter (given below) is designed in Matlab using the poles and zeroes calculated

above.

Figure 5Filter designed, Captured from Matlab

Page 12: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 12

Figure 5 above represents the design of the filter that was constructed using the

utility of the Matlab software (Filter Design and Analysis tool). To start with, a new

filter is created using the SPTOOL utility by clicking on the command button “New” in

the “Filters” column (section) as shown below in Figure 6.

Figure 6 Creating Filter, Captured from Matlab

After this, for the filter to be designed two poles (represented by “x” in the figure

above) are placed at magnitude of -0.33 Hz (-1/3 Hz) and at 0.5 Hz (1/2 Hz) which

were calculated above. Zero was placed at the origin as shown by a hole in the

figure given above. Then the analysis parameters were changed to magnitude as

can be seen in the figures below. For this to happen “Analysis” panel is clicked and

then the “Analysis Parameters …” is selected. “Magnitude Display” is also changed

to “Magnitude Db” for more precise results. The gain was taken from the system

which was 4.

Figure 7 Designing Filter, Captured from Matlab

Page 13: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 13

Sampling frequency was also changed to 40Hz which was done by clicking the

“Analysis” panel and selecting the option “Sampling Frequency …”

Figure 8 Designing Filter, Captured from Matlab

All the steps given above were followed to design the filter given in figure.

Question 1, Part (iv): Proof of results obtained in Q1 (ii) by using a suitable m-file:

Signal v = v1+v2+v3

Figure 9 (m-file) Matlab code, Captured from Matlab

Page 14: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 14

To obtain the plot for ( ) ( ) ( ) code given in figure 9

above is developed based on the calculations obtained in part (ii). Plots for individual

signals v1 and v2 are also plotted to observe the changes in the signals before and

after they were filtered. Using the code given above, the graph plotted is shown

below:

( ) ( ) ( )

Figure 10 Signal v for x(t), Captured from Matlab

Code for plotting signal “v1 = 5*cos(40*pi*t)” before it was filtered is given below,

following which the plot is also given:

.

.

.

.

.

.

.

.

Page 15: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 15

Code for plotting signal “v2 = 9*cos(80*pi*t)” before it was filtered is given below,

following which the plot is also given:

Figure 12 (m-file) Matlab code and Plot for signal v2, Captured from Matlab

Figure 11. (m-file) Matlab code and Plot for signal v1, Captured from Matlab

Page 16: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 16

Signal v3, m-file code and Plot below shows DC values:

Figure 13 Signal v3 - the dc value, Captured from Matlab

The signals above were filtered in order to observe the calculated theoretical values

with the values represented by the plots of filtered signals. To begin with “SPTOOL”

utility was opened, then by clicking on the “File” tab and then selecting “Import”

another window will be opened.

Figure 14 Filtering a signal, Captured from Matlab

Importation of content was done using the new opened window given below where

different signals and frequencies were then selected from the “Workspace contents”

panel.

Page 17: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 17

After pressing “OK” the content is imported into SPTOOL which follows another

window given below:

In order to filter the signal, the signal was clicked along with the filter that it would be

applied to. Then after pressing the “Apply” button another window “Apply Filter”

opened from where Algorithm named “Direct-Form II Transposed” was used and

pressed “OK”.

.

.

.

.

Page 18: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 18

Filtered Signal 1

Figure 15 Filtered Input Signal v1, Captured from Matlab

The figure 15 above represents function y[n] = 16.97cos(

). Figure shows

that the results were justified since it‟s a cosine wave with amplitude of 16.9 exactly

and that was also calculated previously.

Filtered Signal 2

Figure 16, Filtered input signal v2, Captured from Matlab

Page 19: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 19

The figure above represents function y[n] = 36( ). Figure shows that the results

were justified since it‟s a cosine wave with amplitude of sharp 36 and that is exactly

what was also calculated previously.

Signal value for DC

Figure 17 Filtered signal v3 - value of DC, Captured from Matlab

Figure 17 above shows filtered value of DC which is 60 as theoretically calculated

previously.

Filtered Output Signal: [ ] = 60 + 16.97cos(

) + 36( )

Figure 18 Filtered output signal v, Captured from Matlab

Page 20: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 20

The output signal given above represents function [ ] = 60 + 16.97cos(

) +

36( ). It adds up all the signals correctly which was verified by summing the

amplitudes together. Amplification factor calculated was 60 + 16.97 + 36 = 112.97

whereas figure shows 111.89373 and 112.797; both are approximately equal to the

original calculated value. The slight difference occurs due to the rounding of the

numbers which was done in calculating theoretical values.

Proof of results obtained in Q1 (iii) by using a suitable m-file:

After manually working out the poles and zeroes, MatLab code given below in figure

19 is derived using the Frequency response

which will do this

calculation itself:

Figure 19 (m-file) MatLab code for Pole-Zero Map, Captured from Matlab

On running the code, pole-zero maps produced in MatLab are given below:

.

.

.

.

.

.

.

.

.

Page 21: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 21

Figure 20 Pole-Zero Map, Captured from Matlab

Pole-zero map given above shows the Pole at - 0.333

Figure 21 Pole-Zero Map, Captured from Matlab

Figure above shows Pole at 0.5

Page 22: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 22

Question 2, Part (i):

The structure of the FIR filter:

[ ] =

[ [ ] - [ ]] is a difference equation, structure is drawn below:

FIR Filters and their advantages/disadvantages

FIR filters are a type of digital filter with “finite impulse response”. They are also known as non-recursive digital filters because they do not have feedback although recursive algorithms can still be used for FIR filter realization.

The main advantage of FIR systems is that they are always stable and they can

design to yield a linear phase response. In order to make linear phase, FIR filter is

very simple to make. So to do it just linear phase filter delay need to be added but

care must be taken not to mislead its phase. FIR filters are very easy to run by

winding a signal instruction; they can be schemed on DSP micro processing. FIR

filters are suitable to make low rating for sampling which is called decimations and

also make more rating for sampling which is called interpolations. They also can be

implemented using coefficient of less than 1.0 magnitude (Guru, 2017).

FIR filters offer several advantages over IIR filters:

They can easily be designed to be "linear phase" (and usually are). Put

simply, linear-phase filters delay the input signal, but don‟t distort its phase.

They are simple to implement. On most DSP microprocessors, the FIR

calculation can be done by looping a single instruction.

They are suited to multi-rate applications. By multi-rate, we mean either

"decimation" (reducing the sampling rate), "interpolation" (increasing the

sampling rate), or both. Whether decimating or interpolating, the use of FIR

filters allows some of the calculations to be omitted, thus providing an

important computational efficiency. In contrast, if IIR filters are used, each

𝑧

𝑧

× x[n] y[n]

- 0.5

x[n-1]

x[n-2]

Page 23: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 23

output must be individually calculated, even if that output is discarded (so the

feedback will be incorporated into the filter).

They have desirable numeric properties. In practice, all DSP filters must be

implemented using "finite-precision" arithmetic, that is, a limited number of

bits. The use of finite-precision arithmetic in IIR filters can cause significant

problems due to the use of feedback, but FIR filters have no feedback, so

they can usually be implemented by using fewer bits, and the designer has

fewer practical problems to solve related to non-ideal arithmetic.

They can be implemented using fractional arithmetic. Unlike IIR filters, it is

always possible to implement a FIR filter using coefficients with magnitude of

less than 1.0. (The overall gain of the FIR filter can be adjusted at its output, if

desired.) This is an important consideration when using fixed-point DSP's,

because it makes the implementation much simpler.

Completely constant group delay throughout the frequency spectrum.

Complete stability at all frequencies regardless of the size of the filter.

Can be implemented with fast convolution.

Relatively insensitive to quantization (Guru, 2017).

Disadvantages of FIR Filters

In comparing the FIR filters with IIR filters, the FIR filters have less disadvantages

but there are some such as they need more memory, to get the applied filter

response characteristic similarly to implement to FIR filter some responses are not

usual.

For a given filter specification they require larger degree with respect to IIR

filters. This is a drawback for FIR.

The frequency response is not as easily defined as it is with IIR filters.

The number of states required to meet a frequency specification may be far

larger than that required for IIR filters.

FIR filters sometimes have the disadvantage that they require more memory

and/or calculation to achieve a given filter response characteristic

Also, certain responses are not practical to implement with FIR filters (Guru,

2017).

Question 2, Part (ii):

[ ]

[ [ ] [ ]] is a difference equation.

Difference equation can be converted to “Transfer Function” by taking the Z –

transform.

Page 24: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 24

Delay in sample time in “Frequency Domain” becomes the power as shown below:-

( ) = ∑ [ ]

Y (Z) =

[ ( ) ( ) ]

Y (Z) =

X (Z) –

X ( )

Y (Z) =

X ( ) ( )

Transfer Function: - H (Z) = ( )

( )

So H (Z) =

( )

Transfer Function “H (Z)” can now be exchanged with Frequency Response “H( )”,

therefore, is substituted with .

So

( ) ⇒

H ( ) =

is frequency response where

represents magnitude and

is phase.

Question 2, Part (iii):

As H (Z) =

( ), this transfer function is used to find poles and zeroes.

Highest power of “Z” is 2 so multiply by .

⇒ (

)

Pole: Z = 0

Zero: Z= 1, -1

The value of “Z” that leads denominator to „0‟ is Pole.

The value of “Z” that leads numerator to „0‟ is Zero.

Frequency response “H (ω)” was found out to be:-

H (ω) =

Now to find the type of filter, let‟s take 3 values of ω as ω = 0, ω =

and ω = π.

Page 25: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 25

When ω = 0 then:-

H ( ) =

H ( ( )) = ( ( )– ( ))

=

=

=

= 0

When ω =

then:-

H ( (

)) =

(

( )

( ))

= ( )

= ( )

=

= 1

When ω = π then:-

H ( ) = ( ( ) ( ))

= ( )

= 0

Figure 22, Band Pass Filter Plot

So, as shown in the graph above:-

When ω = 0; H ( ) = 0

When ω =

; H (

) = 1

When ω = π; H ( ) = 0

Page 26: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 26

Values obtained and the graph drawn proves that it‟s a Band Pass Filter.

Question 3, Part (i):

[ ] =

[ ] + [ ] +

[ ]

Equation above represents IIR (Infinite Impulse Response) Filter which is proven by

the structure given below, it has feedback.

[ ]

[ ] +

[ ]

IIR Filters

IIR filters are one of two primary types of digital filters used in Digital Signal

Processing (DSP) applications (the other type being FIR). "IIR" means "Infinite

Impulse Response”. The impulse response is "infinite" because there is feedback in

the filter; if you put in an impulse (a single "1" sample followed by many "0" samples),

an infinite number of non-zero values will come out theoretically (Guru, 2017).

Advantages of IIR Filter

The advantage of IIR filters over FIR filters is that IIR filters usually require fewer coefficients to execute similar filtering operations, that IIR filters work faster, and require less memory space.

IIR filters can achieve a given filtering characteristic using less memory and calculations than a similar FIR filter (National, 2017).

𝑧

x[n] y[n]

0.5

𝑧

+ +

0.5

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

Page 27: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 27

Disadvantages of IIR Filters

They are more susceptible to problems of finite-length arithmetic, such as

noise generated by calculations, and limit cycles. (This is a direct

consequence of feedback: when the output isn't computed perfectly and is fed

back, the imperfection can compound.

They are harder (slower) to implement using fixed-point arithmetic.

They don't offer the computational advantages of FIR filters for multi-rate

(decimation and interpolation) applications (Hero, 2017).

Question 3, Part (ii):

To determine the transfer function H(z) for IIR filter firstly the y[n] will be converted

into y[z] and then the terms of y(z) and x(z) will be separated as shown below:

[ ] =

[ ] + [ ] +

[ ]

Conversion of y[n] into y[z]

[ ] =

( ) + ( )+

( )

Now collecting like terms

( )

( ) = ( ) +

( )

Simplifying it (taking the common term out)

( ) (

) = ( ) (

)

( )

( ) =

(

)

(

)

As Transfer Function H ( ) = ( )

( )

So ( ) =

Now to get frequency response ( ) is exchanged with ( ) and is substituted

with .

=

Therefore, ( )=

Page 28: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 28

Transfer Function ( )

Question 3, Part (iii):

The transfer function determined above is used to find poles and zeroes of H(Z).

Rule states that the value of „Z‟ that leads denominator to „0‟ is Pole and the value of

„Z‟ that leads numerator to „0‟ is zero.

So

1 +

= 0

= 0 – 1

=

= ⇒

= Z

Zero: Z =

And

=

=

1 = 2Z

= Z

Pole:

The result shows then that ;

The values of Z are less than “1”and greater than “- 1” so it is proved that poles and

zeroes are in the unit circle which makes the filter stable.

Page 29: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 29

Part b - Digital Filter Design using MATLAB and SPTOOL

This section involves plotting the spectrums of two guitar signals, where one signal is

noisy and the other one is clean, then designing the filter, using a suitable m-file, to

reduce or totally remove the noise from noisy signal and finally comparing the filtered

signal with noisy and clean signals to see the amount of noise reduced or totally

removed. Additionally if a real-time system was employed a statement will need to

be made to specify the requirements of the design. To finish it, two current DSP

development kits (available in UK) for audio processing will be discussed.

Question 4, Part (i):

Clean Guitar Signal Plot

Figure 23 Clean Guitar Signal, Captured from Matlab

Page 30: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 30

Spectrum view of clean guitar signal

Figure 24 Spectrum view of clean guitar signal, Captured from Matlab

To draw the above spectrum “Parameters” were changed to FFT (Fast Fourier

Transform) for the “Method” and “NffI” value was set to 110464 as it‟s the length of

the signal.

Then using the “Options” panel (shown below in Figure 25) the “Magnitude Scale”

and the “Frequency Scale” were set to Linear. “Frequency Range” was also changed

to [-Fs/2, Fs/2].

Figure 25, Captured from Matlab

Page 31: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 31

Noisy Guitar Signal Plot

Noise

Figure 26 Noisy Guitar Signal, Captured from Matlab

Spectrum view of Noisy Guitar Signal

F = 4300Hz F = 7400Hz

Figure 27 Spectrum view of noisy guitar signal, capture from Matlab

Page 32: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 32

The spectrum view IN Figure 23 shows that noise occur at frequencies between

4300Hz to 7400 Hz approximately.

Matlab (m-file) codes used to draw plots of clean and noisy guitar signals:

Figure 28 m-file Matlab code, Captured from Matlab

Question 4, Part (ii): Noisy Guitar signal

Figure 29 Noisy guitar signal, Captured from Matlab

Page 33: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 33

Designing LOW-PASS FIR Filter for Noisy signal:

Figure 30 Design of low-pass filter, Captured from Matlab

As shown in the figure 30 above, the Filter is chosen as Lowpass because of its

property to allow very low frequencies to pass through until its cutt-off frequenc. It

also blocks any other higher frequencies that come in contact with it.

Specifications for this filter were selected from six different panels given below:

Response Type: Lowpass.

Design Method: FIR and Equiripple.

Filter Order: Minimum order.

Options: Density Factor chosen to be 20.

Frequency Specifications: Units as Hz, Fs as 22050 as given in assessment

brief, Fpass (the range for which the frequency is allowed to pass into the

filter) chosen was 2000 and Fstop (the range of higher frequencies which are

not allowed to pass) was chosen to be 4000.

Magnitude Specifications: Units as Db, Apass (being passband ripple) was

chosen as 1 and Astop (being stopband attenuation) was chosen as 100.

Following this the noisy signal was applied into the filter to remove the noise.

Page 34: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 34

Filtered (Low-pass FIR) Signal

Figure 31 Filter Signal, Captures from Matlab

The signal above represents the noisy signal after it was filtered using the low-pass

FIR filter. As it can be seen the noise is completely removed and quality of sound (as

it was listened) is clean (without any noise). It can be observed that the noise from 0

seconds to 1.5 seconds is totally removed; it‟s finally a clean signal.

FFT Spectrum of Filtered Signal

Noise is removed

Figure 32 Spectrum of Filtered Signal, Captured from Matlab

Page 35: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 35

Spectrum view after filtering the noisy signal shows that the noise between 4300 Hz

to 7400 Hz is totally eliminated.

Designing LOW-PASS IIR Filter for Noisy signal:

Figure 33 Low-pass IIR Filter Design, Captured from Matlab

Filter shown above represents the Low-pass IIR filter design which was designed in

order to compare with Low-pass FIR filter design.

Specifications for this filter were selected from six different panels given below:

Response Type: Lowpass.

Design Method: IIR and Butterworth.

Filter Order: Minimum order.

Options: passband.

Frequency Specifications: Units as Hz, Fs as 22050 as given in assessment

brief, Fpass (the range for which the frequency is allowed to pass into the

filter) chosen was 2500 and Fstop (the range of higher frequencies which are

not allowed to pass) was chosen to be 4400.

Magnitude Specifications: Units as Db, Apass (being passband ripple) was

chosen as 0.5 and Astop (being stopband attenuation) was chosen as 80.

Following this the noisy signal was applied to the filter to remove the noise.

Page 36: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 36

Filtered (Low-pass IIR) Signal

Figure 34 Low-pass IIR Filtered Signal, Captured from Matlab

Results show that IIR filter is quite decent as it provided very good sound quality when

listened. When comparing IIR filter with FIR filter they both produce almost the same results,

especially while listening, very identical sounds were heard. One thing that can be noticed

after listening to both signals for a couple of times is that FIR has little better quality over IIR.

Question 4, Part (iii):

Real-Time DSP

Real-Time DSP can be defined as a system which uses predefined commands and

algorithms to process a signal placed into the input of that system and which

computes an outcome at the output of that system in real time. The Real-Time DSP

kits are normally expensive and they are in an essence, provisional to their

application and quality. They are available in different sizes, therefore different

prices. They offer features of eliminating and cancelling noise in smart devices. As

an example of daily life use of Real-Time DSP, they cancel the noises out in the

microphone of a smartphone providing the user the ability to speak without any noise

getting in his way. DSP system on a Chip (SOCs) operation is used to eliminate the

noise which disregards all the noise coming in the microphone. Apart from that,

Real-Time DSP is also applied on Electro Cardiograms (ECGs). However, Real-

Time DSP systems have a lot of limitations regarding their memory, their

Page 37: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 37

consumption of power, the speed that they require in order to process and also the

input bandwidth (Sen M Kuo, 2001).

The design considerations needed if a real-time DSP system were employed are as

follows:-

1. Processor data bus

The width of the processor data bus should be fully utilized unless its usage

does not require that. It should be connected with the fastest RAM chips that

its interface can support. Some factors that can affect its efficiency are size

and layout of board, power usage, cross talk and reflection etc. and these

factors should be decided in the beginning of the design phase.

2. Shared/Multi Ported RAM

In case that multi-processor is being used in the design, their access to

shared resources should be reduced. RAM is a common resource in multi-

processor designs and it is designed in two ways. One is Shared RAM and

the other is Dual Ported RAM. In case of shared RAM, arbitration logic should

be used to control excess usage of processors. One will access shared RAM

while others are frozen by external READY delayed cycles. In DPRAM the

arbitration logic is embedded in such a way that no requester‟s cycle is

delayed unless they share the same location. It means that both sides can

share DPRAM access in parallel without going in wait states.

3. Internal RAM usage

The size of the internal memory available in most DSPs being used today is

not enough for the applications running, so the designer should place the

most critical codes like interrupt routines or signal processing algorithms in the

internal RAM and less critical codes like configuration or management

performance in the external RAM.

4. H/W Interrupts

There are a number of details that should be kept in mind while designing with

H/W interrupts e.g. what should be the maximum tolerable interrupt latency

and the maximum interrupt service routine execution time, is there an interrupt

controller for priority resolving or will it be implemented in S/W, is it needed to

nest interrupts according to their priority, how frequent the signal be

generated and will it be edge or level sensed, how to recover a missed

interrupt, what should be maximum tolerable interrupt latency etc.

5. Multi Bus Processors

For best performance of multi bus processors, the connected devices to the

buses should be organized carefully. If a slow device is connected to a bus

with high speed SDRAMs then when the DMA transfers data from/to this slow

Page 38: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 38

device, the core will be blocked. In order to avoid this problem it should be

connected to the other bus. In the same way data structures should be

organized so as to minimize resource conflict between multi units in the

processor.

6. Slow Device Interface

Slow devices like Flash EPROM should be designed in such a way so as to

pipeline the operations e.g. when the processor wants to program Flash

EPROM according to its FSM (Finite State Machine), a good design does not

wait for the EPROM to acknowledge the operation, It should do other jobs

during this process and check it periodically or be invoked by an interrupt

generated based on EPROM condition signals.

7. Maximum Cache Utilization

As caches are too small for the whole code and data to fit in so they should be

designed to minimize the cache misses as much as possible. For maximum

cache utilization, keep these points in mind. The designer should use loops as

much as possible for temporal locality, use arrays instead of separate

variables for utilizing spatial locality, disable interrupts around loops if

appropriate for functionality, divide the loops because the smaller the loop, the

better it will fit into cache and achieve high cache hit rate.

8. Maximum DMA Utilization

Most processors have DMA engines inside as separate units ranging from 1

to 64 DMA channels. These DMA engines should be used as much as

possible because they have three distinct advantages. These advantages are

that highly complex DMA engines can organize data in different formats which

are useful in serving multi-channel TDMs for speech codecs, moving bulk of

data between memory or peripheral in the background and Read/Write data

to/from peripheral on synchronous or asynchronous events in the background

while core is busy with other tasks.

9. Maximum Register Utilization

Most of the code execution is carried out through registers. So when writing

the code in „ C language „ , use stack variables instead of accessing directly to

variables or structures in RAM, By this method the RAM variables are read

only once and then referenced as stack variables so this way there are no

more memory accesses. This way the compiler function is optimized.

In short the processor specifications, all the interfaces, communication paths

with other cards and processors, function specific chipsets on the card, H/W

limitations, and loopholes in the system and specific requirements of the H/W

must be taken into consideration for designing real-time DSP system

architecture (Serhat KOC, 2017).

Page 39: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 39

Real-Time DSP Development Kits

The first example of Real-Time DSP development kit is the one that is developed by

a company named Texas Instruments. The primary kit that is going to be described

is the “TMS320C6748”. It is considered to be a robust-low cost kit based on c6748

processor (Texas Instruments, 2012). The salient features that it provides are:

It provides software and development kit for digital signal processing

advance/improvement regarding audio, biometric applications and more.

It has a feature of face and fingerprint recognition through embedded

analytics which is provided by fast development of apps.

It has a processor which requires low-Power consumption.

It has a variety of performance, power, peripheral and price due to its

scalable platform.

It provides downloadable and duplicable schematics.

It has 128-MByte DDR2 SDRAM and 128-MByte NAND Flash memory.

Also, it has Micro SD/MMC slot and plenty of USB and SD connectors.

Lastly, it provides the benefit of having a decent amount of peripheral

interfaces (Texas, 2017).

The second example of Real-Time DSP development kit is “Stratix V Edition” which

is manufactured by Altera. This kit provides everything needed to create a FPGA

design. The kit consists of all necessary software and hardware requirements. As

per the Altera this kit is compliant of RoHS. Stratix V Edition offers to the user the

ability of developing and testing PCI Express designs at data rates up to Gen3. This

can be done by using the PCIe short card form factor compliant development board.

It also provides the ability of developing and testing subsystems for DDR3 or QDR II

memories. In addition, the the user can utilise the high speed mezzanine card

(HSMC) connectors in order to interface to more than 35 different HSMCs provided

by the Altera partners. Lastly, it supports protocols such as Serial RapidlO, 10 Gbps

Ethernet, SONET, CPRI, OBSAI and others (Intel, 2017).

Conclusion

At the end, it can be said that this report developed significant amount of knowledge

and skills required for Digital Signal Processing. Based on the knowledge and skills

gained in the previous module (Signals and Systems) and current module (DSP) this

assessment was carried out by solving mathematical problems, following which

mathematical techniques were used to implement the calculated theoretical values

and then the m-file code was developed into Matlab software to design filters and

then to filter noise from the noisy guitar signals. Theoretical values and results

calculated were compared and analysed with the results and plots were obtained in

Matlab (by using suitable program code and relevant software skills). Advantages

Page 40: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 40

and disadvantages of DSP, FIR and IIR filters were also found out. Lastly, design

requirements were also specified if a real-time system was to be employed which

ended with discussion on two current DSP developments kits (available in UK) for

audio processing.

Conclusion is made preceding findings, problem faced if any, objectives met (by

answering questions), thorough knowledge and essential skills developed. Although,

it was not an easy assessment but hard work and dedication provided very good

practice in DSP for a prospective electronic engineer.

References

[1] Sehra, J. (2017). Birmingham City University - Sign In. [online] Moodle.bcu.ac.uk. Available at:

http://moodle.bcu.ac.uk/course/view.php?id=11561 [Accessed 24 Dec. 2016].

[2] WhatIs.com. (2017). What is digital signal processing (DSP)? - Definition from WhatIs.com.

[online] Available at: http://whatis.techtarget.com/definition/digital-signal-processing-DSP

[Accessed 23 Dec. 2016].

[3 – 5] Sehra, J. (2017). Birmingham City University - Sign In. [online] Moodle.bcu.ac.uk. Available at:

http://moodle.bcu.ac.uk/course/view.php?id=11561 [Accessed 24 Dec. 2016].

[6] Sehra, J. (2016). Birmingham City University - Sign In. [online] Moodle.bcu.ac.uk. Available at:

http://moodle.bcu.ac.uk/course/view.php?id=7232 [Accessed 2 Jan. 2017].

[7 – 9] Guru, D. (2017). FIR Filter FAQ. [online] Dspguru.com. Available at:

http://dspguru.com/book/export/html/3 [Accessed 20 Dec. 2016].

[10] Guru, D. (2017). IIR Filter Basics | dspGuru.com. [online] Dspguru.com. Available at:

http://dspguru.com/dsp/faqs/iir/basics [Accessed 27 Dec. 2016].

[11] National, I. (2017). IIR Filters and FIR Filters - DIAdem 2012 Help - National Instruments. [online]

Zone.ni.com. Available at: http://zone.ni.com/reference/en-XX/help/370858K-

01/genmaths/genmaths/calc_filterfir_iir/ [Accessed 22 Dec. 2016].

[12] Hero, C. (2017). In contrast since IIR filters use feedback every input - MARKETING - 6500.

[online] Coursehero.com. Available at: https://www.coursehero.com/file/p370g518/In-contrast-

since-IIR-filters-use-feedback-every-input-must-be-used-and-every/ [Accessed 21 Dec. 2016].

[13] Kuo, M. S. (2001). Introduction to Real-Time Digital Signal Processing. In: John Wiley and Sons

Real-Time Digital Signal processing. West Sussex: John Wiley and Sons. p1315.

[14] Serhat KOC, I. (2017). Design considerations for Real-Time with DSP and RISK architecture.

[online] Eurasip. Available at:

http://www.eurasip.org/Proceedings/Eusipco/Eusipco2005/defevent/papers/cr1108.pdf [Accessed

2 Jan. 2017].

Page 41: JANUARY 9, 2017 · reals). That is, the function's domain is an uncountable set. The function itself need not be continuous. On the other hand, a discrete time signal has a countable

ID: s09466807 Page 41

[15] Texas, I. (2017). TMS320C6748 DSP Development Kit. [online] Texas Instruments. Available at:

http://www.ti.com/lit/ml/sprt633/sprt633.pdf [Accessed 3 Jan. 2017].

[16] Intel, F. (2017). DSP Development Kit, Stratix V Edition. [online] Altera.com. Available at:

https://www.altera.com/products/boards_and_kits/dev-kits/altera/kit-stratix-v-dsp.html [Accessed

4 Jan. 2017].

Bibliography

[1] Rafael Esquivel, (2013). ECE 309 - Designing Filters Using MATLab. [video] Available at:

https://www.youtube.com/watch?v=Y7faUKlsQ8c [Accessed 20 Dec. 2016].

[2] David Dorran, (2013). filtering in matlab using 'built-in' filter design techniques. [video] Available

at: https://www.youtube.com/watch?v=vfH5r4cKukg&list=PLdi4UEKwp7QMBvMWR_sbr2yzYiU-

XyZeS [Accessed 18 Dec. 2016].