chapt2
DESCRIPTION
Jaringan KomputerTRANSCRIPT
![Page 1: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/1.jpg)
Chapter 2. Discrete-Time Signals and Systems
Gao Xinbo
School of E.E., Xidian [email protected]
http://see.xidian.edu.cn/teach/matlabdsp/
![Page 2: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/2.jpg)
Main Contents Important types of signals and their operations Linear and shift-invariant system
Easier to analyze and implement The convolution and difference equation
representations Representations and implementation of signal
and systems using MATLAB
![Page 3: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/3.jpg)
Discrete-time signals Analog and discrete signals analog signal
t represents any physical quantity, time in sec. Discrete signal: discrete-time signal
N is integer valued, represents discrete instances in times
)(txa
)(nx
}),1(),0(),1(,{)}({)( xxxnxnx
![Page 4: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/4.jpg)
Discrete-time signal In 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?
}7,3,4,1,0,1,1,2{)( nx
];7,3,4,1,0,1,1,2[
];4,3,2,1,0,1,2,3[
x
n
![Page 5: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/5.jpg)
Types of sequences Elementary sequence for analysis purposes 1. Unit sample sequence
Representation in MATLAB
,0,0,1,0,0,0,0
0,1)(
n
nn
201210
00 ,,
,0
,1)( nnnnnn
nn
nnnn
![Page 6: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/6.jpg)
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’);
-3 -2 -1 0 1 2 30
0.2
0.4
0.6
0.8
1
n
(n
-n0)
-3<n<3
n0=0
![Page 7: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/7.jpg)
2. Unit step sequence
,1,1,1,0,0,0,0
0,1)(
n
nnu
201210
00 ,,
,0
,1)( nnnnnn
nn
nnnnu
A: n=[n1:n2]; x=zeros(1,n2-n2+1); x(n0-n1+1:end)=1;
B: n=[n1:n2]; x=[(n-n0)>=0];
![Page 8: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/8.jpg)
3. Real-valued exponential sequence
Rananx n ;,)(
For Example:
100,)9.0()( nnx n
n=[0:10]; x=(0.9).^n; stem(n,x,’ro’)
0 1 2 3 4 5 6 7 8 9 100
0.2
0.4
0.6
0.8
1
![Page 9: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/9.jpg)
4. Complex-valued exponential sequence
nenx nj ,)( )( 0
Attenuation: 衰减因子frequency in radians:
For Example: n=[0:10]; x=exp((2+3j)*n);
![Page 10: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/10.jpg)
5. Sinusoidal sequence
nnnx ),cos()( 0
Phase in radians
For Example:
n=[0:10]; x=3*cos(0.1*pi*n+pi/3)+2*sin(0.5*pi*n)
![Page 11: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/11.jpg)
6. Random sequence Rand(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]
![Page 12: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/12.jpg)
7. Periodic sequence A sequence x(n) is periodic if x(n)=x(n+N) The smallest integer N is called the
fundamental period For example A: xtilde=[x,x,x,…x] B: xtilde=x’*ones(1,P); xtilde=xtilde(:);
xtilde=xtilde’; transposition
![Page 13: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/13.jpg)
Operations on sequence 1. Signal addition
Sample-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<=max(n1))==1))=x1;
y2(find((n>=min(n2)) & (n<=max(n2))==1))=x2;
Y=y1 + y2;
![Page 14: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/14.jpg)
2. Signal multiplication Sample-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<=max(n1))==1))=x1;
y2(find((n>=min(n2)) & (n<=max(n2))==1))=x2;
Y=y1 .* y2;
![Page 15: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/15.jpg)
3. Scaling a{x(n)}={ax(n)}
5. folding
y(n)={x(n-k)} m=n-k; y=x;
4. Shifting
y(n)={x(-n)} y=fliplr(x); n=-fliplr(n);
![Page 16: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/16.jpg)
6. Sample summation
ss = sum(x(n1:n2);
7. Sample production
sp = prod(x(n1:n2));
2
1
)()()( 21
n
nn
nxnxnx
)()()( 21
2
1
nxnxnxn
nn
![Page 17: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/17.jpg)
8. Signal energy
se = sum(x .* conj(x)); or
se = sum(abs(x) .^ 2);
9. Signal power
nnx nxnxnx 2* |)(|)()(
1
0
2|)(|1 N
nx nx
NP
![Page 18: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/18.jpg)
Examples Ex020100 – composite basic sequences Ex020200 – operation on sequences Ex020300 – complex sequence generation Ex020400 – even-odd decomposition
![Page 19: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/19.jpg)
Some useful results Unit sample synthesis
Any 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)
k
knkxnx )()()(
![Page 20: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/20.jpg)
)]()([2
1)(
)]()([2
1)(
nxnxnx
nxnxnx
o
e
Function [xe, x0, m] = evenodd(x,n)
If any(imag(x) ~= 0)
error(‘x is not a real sequence’);
End
m = -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));
![Page 21: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/21.jpg)
The geometric series A 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
1||,1
1
0
afor
aa
n
n
aa
aa
NN
n
n
,
1
11
0
![Page 22: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/22.jpg)
Correlations of sequences It 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
Autocorrelation
nyx lnynxlr )()()(,
nxx lnxnxlr )()()(,
The index l is called the shift or lag parameter.
The special case: y(n)=x(n)
![Page 23: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/23.jpg)
Discrete Systems Mathematically, an operation T[.]
y(n) = T [ x(n)] x(n): excitation, input signal y(n): response, output signal
Classification Linear systems Nonlinear systems
![Page 24: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/24.jpg)
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)
)(),(,,
)]([)]([)]()([
2121
22112211
nxnxaa
nxLanxLanxanxaL
])([)()()()]([)(
nn
knLkxknkxLnxLny
)]([ knL
n
knhkxny ),()()(
h(n,k): the time-varying impulse response
![Page 25: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/25.jpg)
Linear time-invariant (LTI) system A linear system in which an input-output pair is invariant to a shift n in
time is called a linear times-invariant system y(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).
)()]([),( knhknLknh
)(*)()()()]([)( nhnxknkkxnxLTInyk
![Page 26: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/26.jpg)
Properties of the LTI system Stability
A 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
n
nhStabilityBIBO |)(|
![Page 27: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/27.jpg)
Properties of the LTI system Causality
A system is said to be causal if the output at index n0 depends only on the input up to and including the index n0
The output does not depend on the future values of the input
Condition: h(n) = 0, n < 0 Such a sequence is termed a causal sequence.
To make sure that systems can be built.
![Page 28: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/28.jpg)
Convolution Convolution can be evaluated in many different ways
If 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 version Matlab implementation
Function [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)
![Page 29: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/29.jpg)
Function form of convolution
)()9.0(1)(*)()(
)()9.0()(),10()()(9
0
knunhnxny
nunhnununx
kn
k
n
Three different conditions under which u(n-k) can be evaluated:
Case 1: n<0 % the nonzero values of x(n)and y(n) do not overlap.
Case 2: 0<=n<9 % partially overlaps
Case 3: n>=9 % completely overlaps
![Page 30: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/30.jpg)
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.
![Page 31: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/31.jpg)
![Page 32: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/32.jpg)
Sequence correlations revisited The correlation can be computed using the conv function if
sequences are of finite duration.
Example 2.8 The meaning of the crosscorrelation This approach can be used in applications like radar signal
processing in identifying and localizing targets.
kkxx
kkyx
nxnxnkxnxknxnxnr
nxnynkxnyknxnynr
)(*)())(()()()()(
)(*)())(()()()()(
![Page 33: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/33.jpg)
Difference Equation An 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 N It describes a recursive approach for computing the
current output,given the input values and previously computed output values.
nmnxbknyaM
mm
N
kk
,)()(
00
M
m
N
kkm knyamnxbny
0 1
)()()(
![Page 34: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/34.jpg)
Solution of difference equation y(n) = yH(n) + yP(n)
Homogeneous part: yH(n) Particular part: yP(n)
Analytical approach using Z-transform will be discussed in Chapter 4
Numerical solution with Matlab y = filter(b,a,x)
Example 2.9
![Page 35: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/35.jpg)
Zero-input and Zero-state response In 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:
0,)()()(0 1
nknyamnxbnyM
m
N
kkm
}1);({}1);({ nMnxandnNny
)()()( nynyny ZSZI Solution:
![Page 36: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/36.jpg)
Zero-input and Zero-state response
yZI(n): zero-input solution A solution due to the initial conditions alone
yZS(n): zero-state solution A solution due to input x(n) alone
![Page 37: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/37.jpg)
Digital filter Discrete-time LTI systems are also called digital filter. Classification
FIR filter & IIR filter FIR filter
Finite-duration impulse response filter Causal FIR filter
h(0)=b0,…,h(M)=bM
Nonrecursive or moving average (MA) filter Difference equation coefficients, {bm} and {a0=1} Implementation in Matlab: Conv(x,h); filter(b,1,x)
M
mm mnxbny
0
)()(
![Page 38: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/38.jpg)
IIR filter Infinite-duration impulse response filter Difference equation
Recursive filter, in which the output y(n) is recursively computed from its previously computed values
Autoregressive (AR) filter
N
kk nxknya
0
)()(
![Page 39: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/39.jpg)
ARMA filter Generalized IIR filter
It has two parts: MA part and AR part Autoregressive moving average filter, ARMA Solution
filter(b,a,x); %{bm}, {ak}
0,)()()(0 1
nknyamnxbnyM
m
N
kkm
![Page 40: Chapt2](https://reader033.vdocuments.us/reader033/viewer/2022051820/563dbaf9550346aa9aa93253/html5/thumbnails/40.jpg)
Reference and Assignment Textbook: pp1 to pp35 Chinese reference book: pp1 to pp18
丁玉美、高西全编的“数字信号处理”(第二版),西电出版社 ,2001年 1月
Exercises: Textbook: p2.1b,c; p2.2b,d; 选 2.5 Textbook: P2.12b, 2.15, 2.17b, 选 2.8