Digital Signal Processing Moslem Amiri, Václav Přenosil Masaryk University Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011. Discrete Sequences and Systems 2 Discrete Sequences and Their Notation  Signal processing  Science of analyzing time-varying physical processes  Continuous signal  Continuous in time  Continuous range of amplitude values  Analog (continuous) signal processing  Discrete-time signal  Time variable is quantized  Signal amplitude is quantized  Because we represent all digital quantities with binary numbers, there’s a limit to the resolution  Digital signal processing 3 Discrete Sequences and Their Notation  Example  A continuous sinewave  Peak amplitude of 1  Frequency fo  fo is measured in hertz (Hz) = cycles/second  t representing time in seconds  fot has dimensions of cycles  2πfot is an angle measured in radians )2sin()( tftx o 4 Discrete Sequences and Their Notation continuous sinewave  sample it once every ts seconds using an analog-todigital converter variable t is continuous Index variable n is discrete and can have only integer values x(n) is a discrete-time sequence of individual values: There is nothing between dots of x(n) )2sin()( )2sin()( so o ntfnx tftx     x(t) and x(n) are referred to as timedomain signals 5 Discrete Sequences and Their Notation  Discrete system  A collection of hardware components, or software routines, that operate on a discrete-time signal sequence  E.g., 1)(2)(  nxny 6 Discrete Sequences and Their Notation  Given samples of a discrete-time sinewave (e.g., Fig. 1-1(b)), find frequency of waveform they represent  Possible to say sinewave repeats every 20 samples  Not possible to find exact sinewave frequency  We need sample period ts to determine absolute frequency of discrete sinewave  If ts = 0.05 milliseconds/sample  Sinewave’s frequency = 1/(1 ms) = 1 kHz dsmillisecon1 sample dsmillisecon0.05 period samples20 periodsinewave  7 Discrete Sequences and Their Notation  Frequency domain  To represent frequency content of discrete timedomain signals  Called spectrum 8 Discrete Sequences and Their Notation xsum(n) has a frequency component of fo Hz and a reduced-amplitude frequency component of 2fo Hz )22sin(4.0)2sin()()()( 21 sososum ntfntfnxnxnx   Because x1(n) + x2(n) sinewaves have a phase shift of zero degrees relative to each other, no need to depict this phase relationship in Xsum(m) (In general, phase relationships in frequency-domain sequences are important) 9 Signal Amplitude, Magnitude, Power  Amplitude of a variable  Measure of how far, and in what direction, that variable differs from zero  Can be either positive or negative  Magnitude of a variable  Measure of how far, regardless of direction, its quantity differs from zero  Always positive 10 Signal Amplitude, Magnitude, Power 11 Signal Amplitude, Magnitude, Power  In frequency domain, we are often interested in power level of signals  Power of a signal is proportional to its amplitude (or magnitude) squared  Assuming proportionality constant is one, power of a sequence in time or frequency domains are  Often we want to know the difference in power levels of two signals in frequency domain  Because of squared nature of power, two signals with moderately different amplitudes will have a much larger difference in their relative powers 22 |)(|)(,|)(|)( mXmXnxnx pwrpwr  12 Signal Amplitude, Magnitude, Power  Because of their squared nature, plots of power values often involve showing both very large and very small values on same graph  To make these plots easier to generate and evaluate, decibel scale is usually employed 13 Signal Processing Operational Symbols  Block diagrams  Are used to graphically depict the way digital signal processing operations are implemented  Comprise an assortment of fundamental processing symbols 14 Signal Processing Operational Symbols 15 Discrete Linear Time-Invariant Systems  Linear time-invariant (LTI) systems  Vast majority of discrete systems used in practice are LTI systems  LTI systems are very accommodating when it comes to their analysis  We can use straightforward methods to predict performance of any digital signal processing scheme as long as it’s linear and time invariant 16 Discrete Linear Systems  Linear  A linear system’s output resulting from a sum of individual inputs is superposition (sum) of individual outputs  Also, if inputs are scaled by constant factors c1 and c2, output sequence parts are scaled by those factors too )()()()( )()( )()( 2121 22 11 nynynxnx nynx nynx inresults inresults inresults       )()()()( 22122211 nycnycnxcnxc inresults   17 Discrete Linear Systems linearity: x3(n) input sequence is sum of a 1 Hz sinewave and a 3 Hz sinewave thus y3(n) is sample-forsample sum of y1(n) and y2(n) also output spectrum Y3(m) is sum of Y1(m) and Y2(m) 18 Discrete Linear Systems 19 Discrete Linear Systems  Fig. 1-8(b)  y1(n) is a cosine wave of 2 Hz and a peak amplitude of −0.5, added to a constant value (zero Hz) of 1/2  Fig. 1-8(c)  y2(n) contains a zero Hz and a 6 Hz component 2 )22cos( 2 1 2 )14cos( 2 )0cos( 2 )1212cos( 2 )1212cos( )( 2 )cos( 2 )cos( )sin()sin( )12sin()12sin()]([)( )12sin()2sin()( 1 2 11 1 ss ssss ss sso ntnt ntntntnt ny ntntnxny ntntfnx                     20 Discrete Linear Systems  Fig. 1-8(d)  x3(n) comprises sum of a 1 Hz and a 3 Hz sinewave  Two additional sinusoids are present in y3(n) because of system’s nonlinearity, a 2 Hz cosine wave (amp=+1), a 4 Hz cosine wave (amp=−1) HzHzab ntnt ntntntnt ntntab HzHzzerob HzHzzeroa bababaHzbHza ss ssss ss 4and22 )42cos()22cos( 2 )3212cos(2 2 )3212cos(2 )32sin()12sin(22 6and 2and 2)(sinewave3,sinewave1 2 2 222              21 Time-Invariant Systems  Time-invariant system  A time delay (or shift) in input sequence causes an equivalent time delay in system’s output sequence  k is some integer representing k sample period time delays  For a system to be time invariant, above equation must hold true for any integer value of k and any input sequence )()()()( )()( '' knynyknxnx nynx inresults inresults     22 Time-Invariant Systems input sequence x′(n) is equal to sequence x(n) shifted to right by k = −4 samples x′(n) = x(n − 4) system is time invariant because y′(n) output sequence is equal to y(n) sequence shifted to right by four samples y′(n) = y(n − 4) 23 Commutative Property of LTI Systems  LTI systems have a useful commutative property  Their sequential order can be rearranged with no change in their final output 24 Analyzing LTI Systems  Unit impulse response of an LTI system  System’s time-domain output sequence when input is a single unity-valued sample (unit impulse) preceded and followed by zero-valued samples  System’s unit impulse response completely characterizes the system 25 Analyzing LTI Systems 26 Analyzing LTI Systems  Knowing impulse response, we can determine system’s output for any input  Output is equal to convolution of input sequence and system’s impulse response  Moreover, we can find system’s frequency response by taking discrete Fourier transform of that impulse response 27 Analyzing LTI Systems a 4-point moving averager   n nk kxnxnxnxnxny 3 )( 4 1 )]3()2()1()([ 4 1 )( frequency magnitude response plot shows that moving averager has characteristic of a lowpass filter: averager attenuates (reduces amplitude of) high-frequency signal content applied to its input