Discrete-Time Signals and Systems: Gao Xinbo School of E.E., Xidian Univ
Discrete-Time Signals and Systems: Gao Xinbo School of E.E., Xidian Univ
Discrete-Time Signals and Systems: Gao Xinbo School of E.E., Xidian Univ
=
=
=
n
n
n o
2 0 1 2 1
0
0
0
, ,
, 0
, 1
) ( n n n n n n
n n
n n
n n s s s s
=
=
= o
Function [x,n]=impseq(n
0
,n
1
,n
2
)
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 3
0
0.2
0.4
0.6
0.8
1
n
o
(
n
-
n
0
)
-3<n<3
n0=0
2. Unit step sequence
{ } , 1 , 1 , 1 , 0 , 0 ,
0 , 0
0 , 1
) (
|
=
<
>
=
n
n
n u
2 0 1 2 1
0
0
0
, ,
, 0
, 1
) ( n n n n n n
n n
n n
n n u s s s s
<
>
=
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
R a n a n x
n
e = ; , ) (
For Example:
10 0 , ) 9 . 0 ( ) ( s s = n n x
n
n=[0:10]; x=(0.9).^n; stem(n,x,ro)
0 1 2 3 4 5 6 7 8 9 10
0
0.2
0.4
0.6
0.8
1
4. Complex-valued exponential sequence
n e n x
n j
=
+
, ) (
) (
0
e o
Attenuation:
frequency in radians:
For Example: n=[0:10]; x=exp((2+3j)*n);
5. Sinusoidal sequence
n n n x + = ), cos( ) (
0
u e
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 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]
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
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;
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;
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);
6. Sample summation
ss = sum(x(n1:n2);
7. Sample production
sp = prod(x(n1:n2));
=
+ + =
2
1
) ( ) ( ) (
2 1
n
n n
n x n x n x
) ( ) ( ) (
2 1
2
1
n x n x n x
n
n n
=
H
=
8. Signal energy
se = sum(x .* conj(x)); or
se = sum(abs(x) .^ 2);
9. Signal power
+
=
+
=
= =
n n
x
n x n x n x
2 *
| ) ( | ) ( ) ( c
=
=
1
0
2
| ) ( |
1
N
n
x
n x
N
P
Examples
Ex020100 composite basic sequences
Ex020200 operation on sequences
Ex020300 complex sequence generation
Ex020400 even-odd decomposition
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): x
e
(-n)=x
e
(n)
Odd (antisymmetric): x
o
(-n)=-x
o
(n)
Any arbitrary real-valued sequence can be decomposed
into its even and odd component: x
(n)=x
e
(n)+ x
o
(n)
+
=
=
k
k n k x n x ) ( ) ( ) ( o
)] ( ) ( [
2
1
) (
)] ( ) ( [
2
1
) (
n x n x n x
n x n x n x
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));
The geometric series
A one-side exponential sequence of the form {a
n
, 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
<
=
a f or
a
a
n
n
a
a
a
a
N
N
n
n
=
,
1
1
1
0
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
+
=
=
n
y x
l n y n x l r ) ( ) ( ) (
,
+
=
=
n
x x
l n x n x l r ) ( ) ( ) (
,
The index l is called the shift or lag
parameter.
The special case: y(n)=x(n)
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
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)
) ( ), ( , ,
)] ( [ )] ( [ )] ( ) ( [
2 1 2 1
2 2 1 1 2 2 1 1
n x n x a a
n x L a n x L a n x a n x a L
+ = +
] ) ( [ ) ( ) ( ) ( )] ( [ ) (
+
=
+
=
=
(
= =
n n
k n L k x k n k x L n x L n y o o
)] ( [ k n L o
+
=
=
n
k n h k x n y ) , ( ) ( ) (
h(n,k): the time-varying impulse response
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).
) ( )] ( [ ) , ( k n h k n L k n h = = o
) ( * ) ( ) ( ) ( )] ( [ ) ( n h n x k n k k x n x LTI n y
k
+
=
A
= = =
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
n h Stability BIBO | ) ( |
Properties of the LTI system
Causality
A system is said to be causal if the output at index n
0
depends only on the input up to and including the index n
0
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.
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)
Function form of convolution
) ( ) 9 . 0 ( 1 ) ( * ) ( ) (
) ( ) 9 . 0 ( ) ( ), 10 ( ) ( ) (
9
0
k n u n h n x n y
n u n h n u n u n x
k n
k
n
= =
= =
=
=
M
m
m
m n x b n y
0
) ( ) (
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
k
k
n x k n y a
0
) ( ) (
ARMA filter
Generalized IIR filter
It has two parts: MA part and AR part
Autoregressive moving average filter, ARMA
Solution
filter(b,a,x); %{b
m
}, {a
k
}
0 , ) ( ) ( ) (
0 1
> =
= =
n k n y a m n x b n y
M
m
N
k
k m
Reference and Assignment
Textbook: pp1 to pp35
Chinese reference book: pp1 to pp18
,20011
Exercises:
Textbook: p2.1b,c; p2.2b,d; 2.5
Textbook: P2.12b, 2.15, 2.17b, 2.8