Discrete time signals and systems Chapter 2 (Part 1) Outline • Articles: 2.1 : 2.1.1 – 2.1.3 2.2 : 2.2.1 – 2.2.4 2.3 : 2.3.1 – 2.3.5 and 2.3.7 • Examples: All examples from 2.1.1 till 2.3.5except 2.3.6 and 2.3.7 • Problems: 2.2, 2.6, 2.7 (a,b,g,I,j), 2.10, 2.11, 2.16 (a, b(2, 4, 9), 2.19, 2.20, 2.22 (MATLAB) Discrete time signals • Signal is a function of the independent variable n called sample • The instances between sample are not defined and not zero • There are various representations of discrete signals. One of the representations is the sequence representation: x ( n) 3,4, 5,8 x ( n) 3,4,5,8, x ( n) ,3,4, 5,8, infinite finite (4 point) all zeros before 3 Basic Signals • Unit sample or impulse: 1, for n 0 ( n) 0, for n 0 Basic Signals contd. • Unit step: 1, for n 0 u ( n) 0, for n 0 Basic Signals contd. • Unit ramp: n, for n 0 u r ( n) 0, for n 0 Basic Signals contd. • Real exponential signal: x(n) a n for n 0 Basic Signals contd. • Complex exponential signal: when, a re j 2f then the complex exponentia l signal becomes : x(n) r n cos2f n j sin 2f n such that, xR (n) r n cos2f n xI (n) r n sin 2f n and we can plot them both seperately Also, x(n) A(n) r n is the magnitude function of the complex signal Angx(n) (n) 2f n is the phase function of the complex signal n j ( 2 (1/ 20)) n x ( n ) ( 0 . 9 ) e Complex exponential: n j ( 2 (1/ 20) / 3) n x ( n ) ( 0 . 9 ) e Complex exponential: Classification of Discrete-Time Signals Energy and Power signals: • The energy of a signal is defined as: E x ( n) 2 n • It means that we have to take the magnitude of each sample and square it then sum all these values. • If E is finite, then the signals is called an energy signal. • Many signals have infinite energy as well. • The average power is defined as: N 1 2 P lim x ( n ) N 2 N 1 n N But EN N n N x ( n) 2 is the energy of the signals from the interval N n N • Hence, the energy of a signal can be expressed as: E lim E N N And the average power as, 1 P lim EN N 2 N 1 • Note: If E is finite, the P = 0. If E is infinite, the average power P may be finite or infinite. • If P is finite but not zero, then the signal is called power signal. • Periodic signals are power signals. • Example 2.1.1 Classification of Discrete-Time Signals contd. Even and odd signals: • If x(n) x(n) then it is called even and if x( n) x(n) then it is called odd. • Any signal is represented by the sum of the even and odd components of a signal. x(n) xe (n) xo (n) such that, 1 xe (n) x(n) x(n) 2 1 xo (n) x(n) x( n) 2 Original Signal 10 5 0 -5 -6 -4 -2 0 2 4 6 2 4 6 2 4 6 2 4 6 Even Component 10 5 0 -6 -4 -2 0 Odd Component 5 0 -5 -6 -4 -2 0 Even + Odd = Original Signal 10 5 0 -5 -6 -4 -2 0 Operations on Signals Delay and Advancement: • Delaying the signal by k means shifting the signal k samples to the right e.g. x(n-3) and it is written as TDk x(n) x(n k ) • Advancing the signal by k means shifting the signal k samples to the left e.g. x(n+3). • Folding means x(-n) and it is written as FDx(n) x(n) Note: • x(n-k) means delay x(n) • x(-n-k) means advance x(-n) x(n+k) means advance x(n) x(-n+k) means delay x(-n) Time scaling • If x(n) is a discrete signal, then : y (n) x(an) is called time scaling where a is integer • This operation is called down sampling because the resultant signal y(n) will miss some samples from the original signal x(n). • Note that a can not be less than 1. • If the samples are taken from an analog signal xa (t ) at a sampling duration of T sec, then x(n) xa (nT ) . Now if y (n) x(an) then, y (n) xa (anT ) or the sampling duration becomes aT instead of T. This is why this operation is called down sampling. Example 2.1.4 Down sampling on analog signals Addition, Multiplication and Sequence scaling • Addition is done point wise: y(n) x1 (n) x2 (n) • Multiplication is done point wise: y(n) x1 (n) x2 (n) • Sequence scaling: y (n) Ax(n) if A 1 Amplificat ion and if A 1 Attanuatio n • Sequence scaling does not result in change in frequency or phase. Only the power is changed. Extra problems 1- If, 2n 1, for 3 n 3 x ( n) otherwise 0, Then find and plot y (n) 0.5 x(2n 1) . Also discuss the different operation performed on the signal x(n) which results in y(n). 2- The analog signal given below is sampled at a rate of 50samples/s which results in x(n). Now what is the required sampling rate to produce a signal y(n) = x(3n). Does aliasing occurs in case of y(n). What is going to be the sampling frequency required to up-sample the analog signal by a factor of 4 from the original sampling rate of 50Hz. Plot all signals in MATLAB. xa (t ) 4 sin( 20t ) Discrete-Time Systems • A discrete time system is a device or algorithm that operates on a discrete time signals called input or excitation, according to some well defined rule to produce another discrete time signal called output or response. • The method of producing the output is some times called transformation. y (n) T x(n) or x(n) y(n) T Example 2.21 The Accumulator • A system whose output is the sum of the current input and all previous inputs. y ( n) n k k 0 x(k ) x(n k ) • For instance if x(n) [3 1 1 2 4] then the output of the accumulator at n = 2 is: y(2) = x(2)+x(1)+x(0)+ x(-1)+x(-2) • But what about values x(-3), x(-4), … ? Ofcourse we can consider this system to be a device which is just turned on at n = -2. It means that once it is on, the previous status or values of the input has no impact on the system and the system is said to be initially relaxed. Realization of the accumulator y ( n) y ( n) n k k 0 x(k ) x(n k ) n 1 x(k ) x(n) y(n 1) x(n) k • It means that the current output depends on the current input and the previous output. • Note that y(n-1) summarizes the affect of all inputs till n-1. • If we want to find the value of y(n) at n = n0 then, y (n0 ) y (n0 1) x(n0 ) y (n0 1) y (n0 ) x(n0 1) y (n0 2) y (n0 1) x(n0 2) Realization of the accumulator contd. • Now to evaluate y(n0-1), we have the formula: y(n0 1) n0 1 x( k ) k • Note that if the system is relaxed before n = n0 (even if it is not the initial value), then y(n0-1) = 0. • Example 2.2.2 Block diagram representation of discrete time systems Block diagram representation of discrete time systems contd. Example 2.2.3 contd. Example 2.2.3 contd. • Note that if we treat the system as input-output (terminals only), then we are not concerned with the actual implementation. • If we consider the internal structure also, then we know exactly how the input signal is handled. • This system is relaxed at any sample time when all the delays in the system are zero (memory is filled with zero) Properties and classification of discrete time systems Static and dynamic systems: • If the O/P depends on the current input but not the previous or future inputs. (No memory). Generally it is indicated as: y (n) T x(n), n e.g. y (n) 3 2 x(n), y(n) x 3(n) 1 • Other than that, the system is called dynamic. (Memory is there) • Finite memory of length N : in which the current O/P depends on the current input and N previous inputs. e.g. y ( n) N , N 0 x(n k ) This is a finite accumulato r of length N k 0 n y (n) x(n k ) This is a finite accumulato r of length n k 0 y (n) x(n k ) This is an infinite accumulato r k 0 Properties and classification of discrete time systems Time variant and time-invariant: How to check the time variance of a system: 1. Find the expression of x(n) and y(n) for the relaxed system T. 2. Find y(n-k) simply by replacing n by n-k in the y(n) expression. 3. Find T[x(n-k)] = y(n,k) simply by replacing x(n) by x(n-k) in the y(n) expresion. 4. If y(n,k) = y(n-k) then the system is time invariant otherwise, even for a single value of k, the system is time variant. Example 2.2.4 Properties and classification of discrete time systems contd. Linear and non linear: • A linear system is one which satisfies the superposition rule. Linear and non linear contd. • The scaling property of linear systems: • The additive property of linear systems: • General rule for linear systems: Linear and non linear contd. • Another General rule for linear systems: if the input to a system T is 0, and if the output is not zero, then either the system is non linear, or it is linear but non relaxed. • Hence, T is relaxed, superposition is satisfied T is relaxed, superposition or I/P O/P not satisfied T non relaxed, superposition is satisfied T non relaxed, superposition not satisfied • Example 2.2.5 linear non linear linear non-linear Properties and classification of discrete time systems contd. Causal versus non causal systems: • But how can we have future terms like x(n+1). It is not realizable. Certainly we can implement causal systems but how can we implement non causal systems? • Example 2.2.6 Properties and classification of discrete time systems contd. Stable and unstable systems: • It is an important parameter when considering the practical implementation of the discrete systems. • Non stable systems causes unusual behavior and some times results in incorrect outputs. • Bounded means: x(n) M x produces y(n) M y • Example 2.2.7 Consider t he non linear system y (n) y 2 (n 1) x(n) If the input is x(n) C (n), then determine the stability of the system Interconnection of Discrete time systems Interconnection of Discrete time systems contd. • Note: in cascaded system, if the systems are linear and time invariant, then TC is also time invariant and T2T1 T1T2 otherwise T2T1 T1T2 • We can use parallel and cascade interconnection of systems to construct larger systems. • We can break complex systems into smaller subsystems for the purpose of analysis. • This is used more frequently when designing and implementing digital filters. Analysis of Linear time invariant (LTI) systems • An important class of systems is LTI. • The response of LTI systems to any input can be expressed in terms of unit sample response. • The main objective of the analysis of such systems is to find out a relation (expression) between the input and the output discrete signals. • One of the techniques used for such analysis is by finding a solution for the differential equations which characterize such systems. • The other technique is used in which the signal is decomposed into basic signals, then the response of these basic signals are evaluated. The total response of these signals is the response of the actual signal. Decomposition Method • Let x(n) be the input signal to a linear system T. • This signal is decomposed into different basic signals indicated as ck xk (n) such that x(n) ck xk (n) k where ck are the weighting coefficients • If T is linear and relaxed then, ck yk (n) T ck xk (n) then, y(n) T x(n) T ck xk (n) k And hence y(n) ck yk (n) k Decomposition Method contd. • • • • • One of the basic signals being used is the impulse signals (n) Hence, our basic signal ck xk (n) becomes ck (n k ) According to sifting property, x(n) (n k ) x(k ) (n k ) Hence, ck x(k ) The input signal x(n) becomes: x(k ) (n k ) k • Any signal is represented by the weighted sum of impulse signals. The weights are the samples of the signal at k. see example 2.3.1 Decomposition Method contd. • Let h( n, k ) be the response of (n k ) for this linear system. • Hence, the response of ck (n k ) x(k ) (n k ) is x( k ) h( n, k ) • Finally, the response of the input signal x(n) to a linear system T is y(n) such that, x ( n) T x(k ) (n k ) y(n) x(k )h(n, k ) k k • The response of the input signal x(n) to LTI system T is y(n) such that, x ( n) T x(k ) (n k ) y(n) x(k )h(n k ) k k The convolution sum • A relaxed LTI system is completely characterized by a single function h(n) which is the response of the unit impulse (n) • For time variant linear system, we have to evaluate h( n, k ) for each value of k • The response of LTI system is called the convolution sum which is written as: y ( n) x ( n) h( n) How does it work • The convolution is a function of two variables, n (the actual sample time) and k (used for delay and as a dummy variable when evaluating the convolution for a particular value of n) • If we want to evaluate the output y(n) at n n0 , we perform the following operations: Example 2.3.2 : In LTI, h(n) [1, 2,1,1] and x(n) [1,2,3,1] Another Way to visualize Convolution x(k ) h( n k ) Example 2.3.2 contd. Properties of convolution • It is irrelevant which of the two sequences is folded and shifted. We can assume that h(n) is the input signal and x(n) is the response. This is called the commutative law Hence: x ( n) h( n) x ( k ) h( n k ) k h( n) x ( n) h( k ) x ( n k ) k • The only difference is in the intermediate multiplication but not the final output. • To find the output of a system from the given input and impulese response, make a wise choice of which signal to fold and shift. Example 2.3.3 Properties of convolution contd. • Associative law (cascaded LTI systems): x(n) h1 (n) h2 (n) x(n) h1 (n) h2 (n) such that h(n) h1 (n) h2 (n) is the total response • Example 2.3.4 Properties of convolution contd. • Distributive law (parallel LTI systems): x(n) h1 (n) h2 (n) x(n) h1 (n) x(n) h2 (n) such that h(n) h1 (n) h2 (n) is the total response • Generally L h(n) h j (n) j 1 Causal linear time-invariant systems • It is the conventional LTI system but now the current output depends on the current input and or the previous inputs. Let n n0 be the sample at which we want to find the output. Hence, • An LTI system is causal if and only if its impulse response is zero for negative values of n. Solve 2.3.2 using matrix method of causal LTI systems. (What changes are there?) • In both previous equations, the input should be the current and past ones and at the same time, h(n) exist only for n > 0. Causal linear time-invariant systems contd. • Another type of system is the causal LTI systems with causal input sequences. • Causal input sequence means x(n) = 0, for n < 0. Hence the output for such systems become, n n k 0 k 0 y ( n) h( k ) x(n k ) OR y (n) x(k )h(n k ) • The response of a causal system to a causal input sequence is a causal sequence. i.e. y(n) = 0 for n < 0. • Example 2.3.5: Determine the unit step response of the LTI system with impulse response: h(n) a nu(n) a 1 Finite and infinite duration impulse response • All LTI systems are divided into two groups: 1) With finite impulse response (FIR), and 2) With infinite impulse response (IIR). • In FIR systems, the value of h(n) is zero outside some duration of length M. As a special case, in causal FIR systems, the output becomes: M 1 k 0 n k 0 n y (n) h(k ) x(n k ) becomes y (n) y ( n) x ( k ) h( n k ) k becomes y (n) h( k ) x ( n k ) x ( k ) h( n k ) k n M 1 • Note that in causal-FIR, h(n) = 0, for 0 n and n M • The output at any time n is simply a weighted linear combination of the input signal samples x(n), x(n 1), , x(n M 1) Finite and infinite duration impulse response contd. • This system acts as a window by considering the M most recent inputs and neglecting the rest. Hence we say the causal FIR systems have finite memory of length M. • The IIR system has infinite duration and hence the expression is same as the normal causal LTI systems. • One last word: A combination of input/output expression or input/impulse response and ultimately input/impulse response/output completely describe the behavior and the characteristics of the system in terms of linearity, causality, time variance, etc… .