JANUARY 9, 2017 DIGITAL SIGNAL PROCESSING Analytical Principles of DSP and Digital Filter Design PRESENTED TO JAGJIT SEHRA BY ZEESHAN MUSTAFA LATIF ANSARI BEng (Hons) Electronics Engineering ID: s09466807 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 ID: s09466807 Page 2 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 ID: s09466807 Page 3 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 ID: s09466807 Page 4 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). ID: s09466807 Page 5 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. ID: s09466807 Page 6 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 ID: s09466807 Page 7 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 = 𝜃 ± 𝑗 𝑖 𝜃 ID: s09466807 Page 8 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; ID: s09466807 Page 9 Ө = ⇒ ⇒ 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 ID: s09466807 Page 10
Description: