610 likes | 856 Views
ELEN E4810: Digital Signal Processing Topic 2: Time domain. Discrete-time systems Convolution Linear Constant-Coefficient Difference Equations (LCCDEs) Correlation. DT System. x [ n ]. y [ n ]. 1/ M. x [ n ]. z -1. 1/ M. y [ n ]. x [ n -1]. +. z -1. 1/ M. x [ n -2].
E N D
ELEN E4810: Digital Signal ProcessingTopic 2: Time domain • Discrete-time systems • Convolution • Linear Constant-Coefficient Difference Equations (LCCDEs) • Correlation Dan Ellis
DT System x[n] y[n] 1/M x[n] z-1 1/M y[n] x[n-1] + z-1 1/M x[n-2] 1. Discrete-time systems • A system converts input to output: • E.g. Moving Average (MA): y[n] = f (x[n]) (M = 3) Dan Ellis
x[n] A n -1 1 2 3 4 5 6 7 8 9 x[n-1] x[n-2] n n -1 -1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 1/M y[n] x[n] z-1 1/M y[n] x[n-1] n -1 1 2 3 4 5 6 7 8 9 + z-1 1/M x[n-2] Moving Average (MA) Dan Ellis
MA Smoother • MA smooths out rapid variations (e.g. “12 month moving average”) • e.g. x[n] = s[n] + d[n] signal noise 5-pt moving average Dan Ellis
x[n] y[n] + z-1 y[n-1] Accumulator • Output accumulates all past inputs: Dan Ellis
x[n] A n -1 1 2 3 4 5 6 7 8 9 y[n-1] x[n] y[n] + n -1 1 2 3 4 5 6 7 8 9 z-1 y[n] y[n-1] n -1 1 2 3 4 5 6 7 8 9 Accumulator Dan Ellis
DT system x[n] y[n] Classes of DT systems • Linear systems obey superposition: • if input x1[n] outputy1[n], x2y2... • given a linear combination of inputs: • then outputfor alla, b, x1, x2i.e. same linear combination of outputs Dan Ellis
Linearity: Example 1 • Accumulator: Linear Dan Ellis
Linearity Example 2: • “Energy operator”: Nonlinear Dan Ellis
Linearity Example 3: • ‘Offset’ accumulator: but Nonlinear .. unless C = 0 Dan Ellis
Property: Shift (time) invariance • Time-shift of inputcauses same shift in output • i.e. if x1[n]y1[n]then • i.e. process doesn’t depend on absolute value of n Dan Ellis
Shift-invariance counterexample L • Upsampler: Not shift invariant Dan Ellis
Another counterexample • Hence • If then • Not shift invariant - parameters depend on n scaling by time index ≠ Dan Ellis
Linear Shift Invariant (LSI) • Systems which are both linear and shift invariant are easily manipulated mathematically • This is still a wide and useful class of systems • If discrete index corresponds to time, called Linear Time Invariant (LTI) Dan Ellis
Causality • If output depends only on past and current inputs (not future), system is called causal • Formally, if x1[n]y1[n] & x2[n]y2[n] Causal Dan Ellis
Causality example • Moving average:y[n] depends on x[n-k], k ≥ 0 causal • ‘Centered’ moving average.. looks forward in time noncausal • Can sometimes make a non-causal system causal by delaying its output Dan Ellis
DT system x[n] y[n] d[n] 1 n -3 -2 -1 1 2 3 4 5 6 7 Impulse response (IR) • Impulse(unit sample sequence) • Given a system:if x[n] = d[n] then y[n] = h[n] • LSI system completely specified by h[n] ∆ “impulse response” Dan Ellis
a1 x[n] z-1 a2 y[n] + z-1 a3 x[n] 1 n -3 -2 -1 1 2 3 4 5 6 7 a2 a1 y[n] a3 n -3 -2 -1 1 2 3 4 5 6 7 Impulse response example • Simple system: x[n] = d[n] impulse y[n] = h[n]impulse response Dan Ellis
LSI h[n] d[n] LSI h[n-n0] d[n-n0] 2. Convolution • Impulse response: • Shift invariance: • + Linearity: • Can express any sequence with ds:x[n] = x[0]d[n] + x[1]d[n-1] + x[2]d[n-2].. a·d[n-k] + b·d[n-l] a·h[n-k] + b·h[n-l] LSI Dan Ellis
* * * Convolution sum • Hence, since • For LSI, written as • Summation is symmetric in xandhi.e. l = n – k Convolution sum Dan Ellis
x[n] h[n] = h[n] x[n] * * (x[n] h[n]) y[n] = x[n] (h[n] y[n]) * * * * h[n] (x[n] + y[n]) = h[n] x[n] + h[n] y[n] * * * Convolution properties • LSI System output y[n] = input x[n]convolved with impulse responseh[n]h[n] completely describes system • Commutative: • Associative: • Distributive: Dan Ellis
h[n] x[n] y[n] = x[n] h[n] * n n -3 -2 -1 -3 -2 -1 1 2 3 5 6 7 1 2 3 4 5 6 7 Interpreting convolution • Passing a signal through a (LSI) system is equivalent to convolving it with the system’s impulse response h[n] = {3 2 1} x[n]={0 3 1 2 -1} Dan Ellis
h[0-k] 11 k -3 -2 -1 1 2 3 4 5 6 7 9 9 y[n] h[1-k] h[2-k] 2 0 -1 n -3 -2 -1 1 2 3 5 7 k -3 -2 -1 -3 -2 -1 1 2 3 4 5 6 7 1 2 3 4 5 6 7 k -3 -2 -1 1 2 3 5 6 7 Convolution interpretation 1 x[k] • Time-reverse h, shift by n, take inner product against fixed x k Dan Ellis
x[n-1] n -3 -2 -1 1 2 3 4 6 7 11 9 9 y[n] 2 0 -1 n -3 -2 -1 1 2 3 5 7 n k -3 -2 -1 -3 -2 -1 1 2 3 5 6 7 1 2 3 4 5 6 7 Convolution interpretation 2 x[n] • Shifted x’sweighted bypoints in h • Conversely, weighted, delayedversions of h ... h[k] x[n-2] n -3 -2 -1 1 2 3 4 5 7 Dan Ellis
Matrix interpretation • Diagonals in X matrix are equal Dan Ellis
Convolution notes • Total nonzero length of convolving N and M point sequences isN+M-1 • Adding the indices of the terms within the summation gives n: i.e. summation indices move in opposite senses Dan Ellis
Convolution in MATLAB • The M-file convimplements the convolution sum of two finite-length sequences • If then conv(a,b) yields M Dan Ellis
* * Connected systems • Cascade connection: Impulse response h[n] of the cascade of two systems with impulse responses h1[n] and h2[n] is • By commutativity, Dan Ellis
x [ n ] [ n ] x [ n ] d = * * * z [ n ] h [ n ] y [ n ] h [ n ] h [ n ] x [ n ] = = 2 2 1 * Inverse systems • d[n] is identity for convolutioni.e. • Consider • h2[n] is the inverse system ofh1[n] * x[n] y[n] z[n] x [ n ] = if Dan Ellis
Inverse systems • Use inverse system to recover input x[n] from output y[n] (e.g. to undo effects of transmission channel) • Only sometimes possible - e.g. cannot ‘invert’ h1[n] = 0 • In general, attempt to solve * Dan Ellis
Inverse system example • Accumulator: Impulse response h1[n] = m[n] • ‘Backwards difference’.. has desired property: • Thus, ‘backwards difference’ is inverse system of accumulator. Dan Ellis
Parallel connection • Impulse response of two parallel systems added together is: Dan Ellis
3. Linear Constant-Coefficient Difference Equation (LCCDE) • General spec. of DT, LSI, finite-dim sys: • Rearrange for y[n] in causal form: • WLOG, always have d0 = 1 • defined by {dk}, {pk} • order = max(N,M) Dan Ellis
Solving LCCDEs • “Total solution” Complementary Solutionsatisfies Particular Solutionfor given forcing functionx[n] Dan Ellis
Complementary Solution • General form of unforced oscillationi.e. system’s ‘natural modes’ • Assume yc has form Characteristic polynomial of system - depends only on {dk} Dan Ellis
Complementary Solution • factors into rootsli , i.e. • Each/any li satisfies eqn. • Thus, complementary solution:Any linear combination will work ais are free to match initial conditions Dan Ellis
Complementary Solution • Repeated roots in chr. poly: • Complex lis sinusoidal Dan Ellis
Particular Solution • Recall: Total solution • Particular solution reflects input • ‘Modes’ usually decay away for large n leaving just yp[n] • Assume ‘form’ of x[n], scaled by b:e.g. x[n]constant yp[n] = bx[n] = l0n yp[n] = b · l0n (l0 li) or= b nL+1 l0n (l0 li) Dan Ellis
x[n] y[n] + LCCDE example • Need input: x[n] = 8m[n] • Need initial conditions:y[-1] = 1, y[-2] = -1 Dan Ellis
LCCDE example • Complementary solution: • a1, a2 are unknown at this point rootsl1 = -3, l2 = 2 Dan Ellis
LCCDE example • Particular solution: • Inputx[n]is constant = 8m[n] assume yp[n] = b, substitute in: (‘large’ n) Dan Ellis
LCCDE example • Total solution • Solve for unknown ais by substitutinginitial conditionsinto DE at n = 0, 1, ... • n = 0 from ICs Dan Ellis
LCCDE example • n = 1 • solve: a1 = -1.8, a2 = 4.8 • Hence, system output: • Don’t find ais by solving with ICs atn = -1,-2 (ICs may not reflect natural modes) Dan Ellis
LCCDE solving summary • Difference Equation (DE): Ay[n] + By[n-1] + ... = Cx[n] + Dx[n-1] + ...Initial Conditions (ICs):y[-1] = ... • DE RHS = 0 with y[n]=ln roots {li}gives complementary soln • Particular soln: yp[n] ~ x[n]solve for bl0n“at large n” • ais by substituting DE at n = 0, 1, ...ICs fory[-1], y[-2]; yt=yc+ypfory[0], y[1] Dan Ellis
LCCDEs: zero input/zero state • Alternative approach to solving LCCDEs is to solve two subproblems: • yzi[n], response with zero input (just ICs) • yzs[n], response with zero state (just x[n]) • Because of linearity,y[n] = yzi[n]+yzs[n] • Both subproblems are ‘real’ • But, have to solve for ais twice(then sum them) Dan Ellis
LCCDE h[n] d[n] Impulse response of LCCDEs • Impulse response: i.e. solve with x[n] = d[n] y[n] = h[n](zero ICs) • With x[n] = d[n], ‘form’ of yp[n] = 0just solveyc[n]forn = 0,1...to findais Dan Ellis
LCCDE IR example • e.g.(from before); x[n] = d[n];y[n] = 0 for n<0 • n = 0: • n = 1: • thus 1 n ≥ 0 Infinite length Dan Ellis
x[n] y[n] + y[n] ... z-1 2 n -1 1 2 3 4 System property: Stability • Certain systems can be unstable e.g.Output grows without limit in some conditions Dan Ellis
Stability • Several definitions for stability; we useBounded-input, bounded-output (BIBO) stable • For every bounded input output is also subject to a finite bound, Dan Ellis
Stability example • MA filter: BIBO Stable Dan Ellis