Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)1 BME452 Biomedical Signal Processing Lecture 2  Discrete Time Signals and.

Similar presentations


Presentation on theme: "Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)1 BME452 Biomedical Signal Processing Lecture 2  Discrete Time Signals and."— Presentation transcript:

1 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)1 BME452 Biomedical Signal Processing Lecture 2  Discrete Time Signals and Systems

2 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)2 Lecture 2 Outline  In this lecture, we’ll study the following Analogue to digital conversion  Sampling, quantisation, coding, aliasing Digital to analogue conversion (in brief) Classification of systems Basic operations of systems

3 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)3 Analogue to digital conversion  Recorded biological signals are analogue signals  To process analogue signals by digital means (like using a PC), we need to convert them to digital form  I.e. to convert them to a sequence of numbers having finite precision  This process is known as analogue to digital (A/D) conversion, which involves  i) Sampling  ii) Quantisation  iii) Coding

4 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)4 The Sampling Process  Often, a discrete time sequence x[n] is developed by uniformly sampling an analogue signal x(t) as indicated below  I.e. conversion of a continuous-time, continuous amplitude signal into discrete-time signal (i.e. continuous-amplitude, discrete-time)  Done by taking samples at specific uniform intervals of time  The sampling interval is the time of one of these uniform intervals  Sampling frequency is the number of uniform time intervals in one second  The relation between the two signals are Discrete-time signal Analogue signal

5 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)5 Aliasing  Aliasing Aliasing causes ambiguities in reconstruction, i.e. distorts the sampled signal To avoid aliasing, the sampling frequency has to be more than twice of the highest frequency contained in x(t) This is known as Nyquist theorem and the minimum frequency known as Nyquist frequency(rate)

6 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)6 Example – Nyquist rate computation  Consider the analog signal x(t)=3 cos 50t + 10 sin 300 t – cos 100 t What is the Nyquist frequency (rate)?  Answer  Use the generic term, A cos 2ft (or A sin 2ft) to compute the frequencies present in the signal => which are 25 Hz, 150 Hz and 50 Hz  So, Nyquist frequency is 2* highest frequency= 2*150 Hz=300 Hz  In practise, we normally sample at a much higher rate than Nyquist frequency

7 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)7 Quantisation and Coding  Quantisation This is the conversion of discrete-time continuous amplitude signal (after sampling) into discrete-time discrete amplitude signal  Quantisation levels The value of each sample is represented by a value selected from a finite set of possible values Quantisation width= (xmax-xmin)/(No of levels -1) Quantisation error is the error in the quantisation process by rounding to the nearest level  Coding In the coding process, each discrete value is represented by a certain number of bits 2 number of bits no of levels

8 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)8 Example of performing quantisation and coding  Example of quantisation and coding  Eg: Assume after sampling, we have the 5 th sample, x(5)=1.66 volts Assume 9 levels are used to represent amplitude values of 0 V (min) to 2 V (max) Quantisation width= (xmax-xmin)/(No of levels -1) =0.25 V The possible quantised values are 0, 0.25, 0.5, 0.75, 1.00, 1.25, 1.50, 1.75, 2.00 So, x(5) =1.75 volts (rounded to nearest level) = 7 th quantised level 2 number of bits no of levels, so we need at least 4 bits After coding, it is 0111  Quantisation error 1.66 V is represented as 1.75 V, so there is an error of 0.09 V, this is the quantisation error This error can be reduced by using more bits in coding thereby increasing the number of quantisation levels In some hardware, the quantisation is done to the nearest lower level, so it would 1.50 instead of 1.75

9 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)9 Quantisation and coding – further example  For the same example in the previous, what would be the code and quantisation error if 17 levels were used? 17 levels in the range 0 V (min) to 2 V (max) Quantisation width= (xmax-xmin)/(No of levels -1) =0.125 V The possible quantised values are 0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.00, 1.125, 1.25, 1.375, 1.50, 1.625, 1.75, 1.875, 2.00 So, x(5) =1.625 volts (rounded to nearest level) = 13 th quantised level 2 number of bits no of levels, so we need at least 5 bits After coding, it is 01101  Quantisation error 1.66 V is represented as 1.625 V, so there is an error of 0.035 V, this is the quantisation error This error is reduced by the increase of bits/quantisation levels

10 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)10 Digital to analog (D/A) conversion  This is not important for this course  Converts digital to analogue signals by performing some kind of interpolation to ‘connect the dots’  Eg: zero-order hold/staircase approximation A/D converter (the simplest)

11 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)11 Sequences  Sometimes, a discrete-time signal is known as a sequence and vice versa  A discrete-time signal may be a finite length or an infinite-length sequence  Eg: x[n]=3+4n 3, -5n  4 is a finite length sequence with length 4-(-5)+1=10  x[n]=sin(0.1n) is an infinite-length sequence An N length sequence can be increased by padding with zeros  Eg: length 3 changed to length 5

12 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)12 Discrete-time systems  Discrete-time systems operates on an input sequence, according to some prescribed transfer function and produces another output sequence  Example, the input sequence could be a noisy ECG signal that we studied in Quiz 1 and the system outputs a noise reduced ECG signal In this case, the discrete-time system is a band-pass filter  There are some classifications and basic operations for discrete- time systems, which we will study next

13 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)13 Classifications of Discrete-time Systems  As with signals, systems can also be classified as: Static and dynamic systems Linear and non-linear systems Time-variant and time-invariant systems Causal and non-causal systems Stable and non-stable systems

14 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)14 Static and dynamic systems  Static The output of a static system at any time depends only on the input values at that particular time (not on past or future input values) It has no memory or energy storage elements A resistive network is an example Eg: y[n]=4x[n]+(x[n]) 3  Dynamic The output of a dynamic system depends on the inputs at the specific time and at other previous times. Have memory or energy storage elements (eg: capacitive/inductive network) It always contains a difference equation Eg: y[n]=4x[n]-x[n-1]

15 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)15 Linear and non-linear systems  Linear A linear system is one in which the principle of superposition holds  For eg, if the system has two inputs, x[n] and y[n], the superposition is defined as follows  H is the transfer function of the system  Nonlinear If the system does not satisfy the superposition principle, it is non- linear

16 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)16 Time-variant and time-invariant systems  Time invariant or shift-invariant system Also known as fixed system Input-output relationship does not vary with time Eg: H[x(n-k)]=y(n-k) where k is an integer In other words, if y[n] is the response of the system to any input x[n], then the response of the system to the time shifted input is the response of the system to x[n] shifted by the same amount  Time-variant (shift-variant) If the system does not satisfy the above property, it is time- variant/shift-variant.

17 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)17 Causal and non-causal systems  Causal system A causal system is non-anticipatory The response depends only on the present and/or past value of the input, not future values Eg: y[n]=0.5x[n]-x[n-2]  Non-causal system The response depends on some future values of the input Not realisable in practise Eg: y[n]=0.1x[n-1]+x[n]-0.8x[n+1]

18 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)18 Stable and non-stable systems  Stable system A stable system produces bounded output for bounded input In other words, for a bounded (i.e. limited) input, the output does not grow unreasonably large Eg: y[n]=H(x[n]) The energy of x is bounded, |x[n]|Mx for all n => the energy of y is also bounded, |y[n]|My for all n  Non-stable system The response can be unreasonably large for a bounded input

19 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)19 Basic system operations  Product (modulation) y[n]=x[n].w[n] Normally used in windowing – where a discrete time finite signal is obtained from a discrete time infinite signal  Addition y[n]=x[n] + w[n]  Multiplication y[n]=A.x[n] This is the system!

20 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)20 Basic system operations (cont)  Time reversal (folding) y[n]=x[-n] Important operation in filtering Arrow points to n=0  Branching Used to provide multiple copies of the signal  Time shifting y[n]=x[n-N] (delay) y[n]=x[n+N] (advance)

21 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)21 Basic system operations (cont)  Time scaling (downsampling/upsampling)  Downsampling, y[n]=x[nM] In downsampling, every Mth sample of the input sequence is kept and M-1 in between samples are removed No. of samples is reduced Eg: y[n]=x[3n] Figure from S.K.Mitra, DSP 3 rd ed.

22 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)22 Basic system operations (cont)  Upsampling, y[n]=x[n/N] In upsampling, N-1 equidistant zero-values samples are inserted by the upsampler between each consecutive samples of the input sequence No. of samples is increased Eg: y[n]=x[n/3] Figure from S.K.Mitra, DSP 3 rd ed.

23 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)23 Combination of basic operations  Often, a system includes a combination of operations  Example - figure shows a discrete time system block diagram

24 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)24 Example – sequence computation  For the following sequences, defined for 0  n  4 (length=5), a[n]={3 4 6 -9 0} b[n]={2 -1 4 5 -3}  obtain the new sequences c[n]={a[n].b[n]} d[n]={a[n]+b[n]} e[n]=1.5{a[n]}  Ans  c[n]={6 -4 24 -45 0}  d[n]={5 3 10 -4 -3}  e[n]={4.5 6 9 -13.5 0}  These are easy as both a[n] and b[n] have same length. What if their lengths differ?

25 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)25 Example – differing sequence lengths  If the lengths of sequences differ, then pad with zeros (in front or end or in between) to obtain same length sequences and same defined ranges BEFORE applying the operations  Example, for the following sequence f[n]={-2 1 -3} defined for 0  n  2 what would be g[n]=a[n]+f[n]?  Hint: f[n] has length 3, while a[n] has length five, so pad f[n] with 2 zeros  Sometimes, making a table will make it easier  Answer  a[n]={3 4 6 -9 0} defined for 0  n  4  f pad [n]={-2 1 -3 0 0} defined for 0  n  4  f[n] is padded with 2 zeros at the end as to make the defined ranges of a[n] and f pad [n] equal.  So, g[n]={1 5 3 -9 0}

26 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)26 Advanced example  Consider the following sequences: x[n]={-4 5 1 -2 -3 0 2}, -3 n 3 y[n]={6 -3 -1 0 8 7 -2}, -1 n 5 w[n]={3 2 2 -1 0 -2 5}, 2 n 8  The sample values of each of the above sequences outside ranges specified are all zeros. Generate the following sequences (put an arrow at n=0): (a) c[n]=x[-n+2] (b) d[n]=y[-n-3] (c) e[n]=w[-n] (d) u[n]=x[n]+y[n-2] Hint: x(n+k) signal moves k x(n-k) signal moves k x(-n+k) signal moves k x(-n-k) signal moves k  Answer  c[n]={2 0 -3 -2 1 5 -4}  d[n]={-2 7 8 0 -1 -3 6 0 0}  e[n]={5 -2 0 -1 2 2 3 0 0}  u[n]={-4 5 1 -2 3 -3 1 0 8 7 -2}  Continued in next slide

27 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)27 Solution  Prepare tables  Min range, n=-3  Max range, n=8 (a) c[n]=x[-n+2] (b) d[n]=y[-n-3] (c) e[n]=w[-n] (d) u[n]=x[n]+y[n-2]

28 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)28 Precedence of flip operation  For the example in the previous slide,  Is y(-n-3) = y(-(n+3))?  What about y(-n-3) = y(-3-n)?  Try them now  y(-(n+3)) ={-2 7 8 0 -1 -3 6}

29 Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)29 Study guide (Lecture 2)  From this week’s lecture, you should know A/D and D/A conversion Sampling, quantisation, coding procedures Nyquist theorem Basic system operations The different classifications of systems Computation of combined sequence operations Obtaining output sequence given a discrete-time system block diagram and vice versa End of lecture 2


Download ppt "Lecture 2 BME452 Biomedical Signal Processing 2013 (copyright Ali Işın, 2013)1 BME452 Biomedical Signal Processing Lecture 2  Discrete Time Signals and."

Similar presentations


Ads by Google