chapt2

40
Chapter 2. Discrete-Time Signals and Systems Gao Xinbo School of E.E., Xidian Univ. [email protected] http://see.xidian.edu.cn/teach/matlabdsp /

Upload: manu1jhc

Post on 24-Nov-2015

4 views

Category:

Documents


1 download

TRANSCRIPT

  • Chapter 2. Discrete-Time Signals and SystemsGao XinboSchool of E.E., Xidian [email protected]://see.xidian.edu.cn/teach/matlabdsp/

  • Main ContentsImportant types of signals and their operationsLinear and shift-invariant systemEasier to analyze and implementThe convolution and difference equation representationsRepresentations and implementation of signal and systems using MATLAB

  • Discrete-time signalsAnalog and discrete signalsanalog signal t represents any physical quantity, time in sec.Discrete signal: discrete-time signalN is integer valued, represents discrete instances in times

  • Discrete-time signalIn Matlab, a finite-duration sequence representation requires two vectors, and each for x and n.Example:

    Question: whether or not an arbitrary infinite-duration sequence can be represented in MATLAB?

  • Types of sequencesElementary sequence for analysis purposes1. Unit sample sequence

    Representation in MATLAB

  • Function [x,n]=impseq(n0,n1,n2)A: n=[n1:n2]; x = zeros(1,n2-n1+1); x(n0-n1+1)=1;B: n=[n1:n2]; x = [(n-n0)==0]; stem(n,x,ro);

  • 2. Unit step sequence

    A: n=[n1:n2]; x=zeros(1,n2-n2+1); x(n0-n1+1:end)=1;B: n=[n1:n2]; x=[(n-n0)>=0];

  • 3. Real-valued exponential sequence

    For Example:n=[0:10]; x=(0.9).^n; stem(n,x,ro)

  • 4. Complex-valued exponential sequence

    Attenuation: frequency in radians:

    For Example: n=[0:10]; x=exp((2+3j)*n);

  • 5. Sinusoidal sequence

    Phase in radians

    For Example:n=[0:10]; x=3*cos(0.1*pi*n+pi/3)+2*sin(0.5*pi*n)

  • 6. Random sequenceRand(1,N)Generate a length N random sequence whose elements are uniformly distributed between [0,1]Randn(1,N)Generate a length N Gaussian random sequence with mean 0 and variance 1. en [0,1]

  • 7. Periodic sequenceA sequence x(n) is periodic if x(n)=x(n+N)The smallest integer N is called the fundamental periodFor exampleA: xtilde=[x,x,x,x]B: xtilde=x*ones(1,P); xtilde=xtilde(:); xtilde=xtilde; transposition

  • Operations on sequence1. Signal additionSample-by-sample addition{x1(n)}+{x2(n)}={x1(n)+x2(n)}

    Function [y,n]=sigadd(x1,n1,x2,n2)n=min(min(n1),min(n2)): max(max(n1),max(n2));y1=zeros(1,length(n)); y2=y1;y1(find((n>=min(n1)) & (n=min(n2)) & (n

  • 2. Signal multiplicationSample-by-sample multiplication Dot multiplication{x1(n)}.{x2(n)}={x1(n) x2(n)}

    Function [y,n]=sigmult(x1,n1,x2,n2)n=min(min(n1),min(n2)) : max(max(n1),max(n2));y1=zeros(1,length(n)); y2=y1;y1(find((n>=min(n1)) & (n=min(n2)) & (n

  • 3. Scalinga{x(n)}={ax(n)}

    5. foldingy(n)={x(n-k)}m=n-k; y=x;

    4. Shiftingy(n)={x(-n)}y=fliplr(x); n=-fliplr(n);

  • 6. Sample summation

    ss = sum(x(n1:n2);

    7. Sample production

    sp = prod(x(n1:n2));

  • 8. Signal energy

    se = sum(x .* conj(x)); or se = sum(abs(x) .^ 2);

    9. Signal power

  • ExamplesEx020100 composite basic sequences Ex020200 operation on sequencesEx020300 complex sequence generationEx020400 even-odd decomposition

  • Some useful resultsUnit sample synthesisAny arbitrary sequence can be synthesized as a weighted sum of delayed and scaled unit sample sequence.

    Even and odd synthesis Even (symmetric): xe(-n)=xe(n)Odd (antisymmetric): xo(-n)=-xo(n)Any arbitrary real-valued sequence can be decomposed into its even and odd component: x (n)=xe(n)+ xo(n)

  • Function [xe, x0, m] = evenodd(x,n)If any(imag(x) ~= 0) error(x is not a real sequence);Endm = -fliplr(n);m1 = min([m,n]); m2 = max([m,n]); m=m1:m2;nm = n(1)-m(1); n1 = 1:length(n);x1 = zeros(1, length(m)); x1(n1+nm) = x; x = x1;xe = 0.5 * (x + flipflr(x));xo = 0.5*(x - fliplr(x));

  • The geometric seriesA one-side exponential sequence of the form {an, n>=0}, where a is an arbitrary constant, is called a geometric series.

    Expression for the sum of any finite number of terms of the series

  • Correlations of sequencesIt is a measure of the degree to which two sequences are similar. Given two real-valued sequences x(n) and y(n) of finite energy,Crosscorrelation

    AutocorrelationThe index l is called the shift or lag parameter.The special case: y(n)=x(n)

  • Discrete SystemsMathematically, an operation T[.]y(n) = T [ x(n)]x(n): excitation, input signaly(n): response, output signalClassificationLinear systemsNonlinear systems

  • Linear operation L[.]Iff L[.] satisfies the principle of superposition

    The output y(n) of a linear system to an arbitrary input x(n)

    is called impulse response, and is denoted by h(n,k)h(n,k): the time-varying impulse response

  • Linear time-invariant (LTI) systemA linear system in which an input-output pair is invariant to a shift n in time is called a linear times-invariant systemy(n) = L[x(n)] --- y(n-k) = L[x(n-k)]

    The output of a LTI system is call a linear convolution sum

    An LTI system is completely characterized in the time domain by the impulse response h(n).

  • Properties of the LTI systemStabilityA system is said to be bounded-input bounded-output (BIBO) stable if every bounded input produces a bounded output.Condition: absolutely summable

    To avoid building harmful systems or to avoid burnout or saturation in system operation

  • Properties of the LTI systemCausalityA system is said to be causal if the output at index n0 depends only on the input up to and including the index n0The output does not depend on the future values of the inputCondition: h(n) = 0, n < 0Such a sequence is termed a causal sequence.

    To make sure that systems can be built.

  • ConvolutionConvolution can be evaluated in many different waysIf the sequences are mathematical functions, then we can analytically evaluate x(n)*h(n) for all n to obtain a functional form of y(n)Graphical interpretation, folded-and-shifted versionMatlab implementationFunction [y,ny]=conv_m(x,nx,h,nh)nyb = nx(1)+nh(1); nye = nx(length(x))+nh(length(h));ny = [nyb:nye];n = conv(x,h)

  • Function form of convolution

    Three different conditions under which u(n-k) can be evaluated:Case 1: n

  • Folded-and-shiftedSignals x=[x(1),x(2),x(3),x(4),x(5)]System Impulse Response: h=[h(1),h(2)h(3),h(4)]y=conv(x,h)y(1)=x(1)*h(1); y(2)=x(1)*h(2)+x(2)*h(1)y(3)=x(1)*h(3)+x(2)*h(2)+x(3)*h(1); x(1),x(2),x(3),x(4),x(5) h(4),h(3),h(2),h(1)Note that the resulting sequence y(n) has a longer length than both the x(n) and h(n) sequence.

  • Sequence correlations revisitedThe correlation can be computed using the conv function if sequences are of finite duration.

    Example 2.8The meaning of the crosscorrelationThis approach can be used in applications like radar signal processing in identifying and localizing targets.

  • Difference EquationAn LTI discrete system can also be described by a linear constant coefficient difference equation of the form

    If aN ~= 0, then the difference equation is of order NIt describes a recursive approach for computing the current output,given the input values and previously computed output values.

  • Solution of difference equationy(n) = yH(n) + yP(n)Homogeneous part: yH(n)Particular part: yP(n)Analytical approach using Z-transform will be discussed in Chapter 4Numerical solution with Matlaby = filter(b,a,x)Example 2.9

  • Zero-input and Zero-state responseIn DSP the difference equation is generally solved forward in time from n=0. Therefore initial conditions on x(n) and y(n) are necessary to determine the output for n>=0.

    Subject to the initial conditions:

    Solution:

  • Zero-input and Zero-state responseyZI(n): zero-input solutionA solution due to the initial conditions aloneyZS(n): zero-state solutionA solution due to input x(n) alone

  • Digital filterDiscrete-time LTI systems are also called digital filter.ClassificationFIR filter & IIR filterFIR filterFinite-duration impulse response filterCausal FIR filter

    h(0)=b0,,h(M)=bMNonrecursive or moving average (MA) filterDifference equation coefficients, {bm} and {a0=1}Implementation in Matlab: Conv(x,h); filter(b,1,x)

  • IIR filterInfinite-duration impulse response filterDifference equation

    Recursive filter, in which the output y(n) is recursively computed from its previously computed valuesAutoregressive (AR) filter

  • ARMA filterGeneralized IIR filter

    It has two parts: MA part and AR partAutoregressive moving average filter, ARMASolutionfilter(b,a,x); %{bm}, {ak}

  • Reference and AssignmentTextbook: pp1 to pp35Chinese reference book: pp1 to pp18,20011

    Exercises:Textbook: p2.1b,c; p2.2b,d; 2.5Textbook: P2.12b, 2.15, 2.17b, 2.8