Вы находитесь на странице: 1из 6

EEE420 Lab Handout

LAB # 3 HANDOUT
1. DISCRETE SYSTEMS

Mathematically, a discrete-time system (or discrete system for short ) is


described as an operator T[.] that takes a sequence x(n) and transforms it into
another sequence y(n)(called response).

y(n)=T[x(n)]

Discrete systems have different classifications based on the input and output
relation:

1.1 LINEARITY
The system is linear if it satisfies superposition principles.

x1(n) y1(n)

x2(n) y2(n)

Then for linearity,

x1(n) + x2(n) y1(n) + y2(n)

A discrete system T[.] is a linear operator L[.] if and only if L[.] satisfies the
principle of superposition.
y(n)=L[x(n)]

1.2 TIME INVARIANCE

x1(n) y1(n)

x1(n-n0) y1(n-n0)

A system which satisfies both of the conditions is called Linear Time-Invariant


(LTI) system.

The impulse response of an LTI system is given by h(n).


x(n) h(n) y(n)

1
EEE420 Lab Handout

This system can be described as y(n) =x(n)*h(n)



Or y (n) = x (k )h(n k )
k =
1.3 STABILITY
A system is said to be bounded-input bounded output(BIBO) stable if every
bounded input produces a bounded output.

|x(n)|< |y(n)| <

An LTI system is BIBO stable if and only if its impulse response is absolutely
summable.

BIBO stability
n =
h( n) <

2. CONVOLUTION

The convolution operation was introduced before to describe the response of an


LTI system. Convolution can be evaluated in many different ways. If the
sequences are mathematical functions, then we can analytically evaluate for all n
to obtain a functional form of y(n).


y(n) =x(n)*h(n) or y ( n) = x (k )h(n k )
k =

Ex:

x(n)={ 3,11,7,0,-1,4,2 } , -3 n 3;
h(n)={ 2,3,0,-5,2,1 } , -1 n 4;
Determine the convolution y(n)=x(n)*h(n)
Solution:

Beginning point (first nonzero sample) of y(n) is given by n= -3+(-1) = -4, while
the end point (the last nonzero sample) is given by n = 3+4 = 7.

y ( n) = x(k )h(n k ) and
k =
for n=0 y(0)=0*4 + 3*2 + 11*-5 + 7*0 + 0*3 + -1*2 + 4*0 + 2*0= -51

for n=-1 y(-1)= 0*1 + 0*2 + 3*-5 + 11*0 + 7*3 + 0*2 + -1*0 + 4*0 + 2*0= 6

for n=2 y(2)= 11*1 + 7*2 + 0*-5 + -1*0 + 4*3 + 2*2= 41

2
EEE420 Lab Handout

x (k )
12

10

-2
-3 -2 -1 0 1 2 3

h(k)
3

-1

-2

-3

-4

-5
-1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4

h(-k )
3

-1

-2

-3

-4

-5
-4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1

h(-1-k)
3

-1

-2

-3

-4

-5
-5 -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0

h(2-k )
3

-1

-2

-3

-4

-5
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3

In matlab
>> y=conv(x,h);
The convolution function assumes that the two sequences begin at n=0.

3
EEE420 Lab Handout

>> x=[3,11,7,0,-1,4,2];
>> h=[2,3,0,-5,2,1];
>> y=conv(x,h);
y =

Because of this, we do not use this. We will use:


M-file:

function [y,ny]=conv_m(x,nx,h,nh)
nyb=nx(1)+nh(1); nye=nx(length(x))+nh(length(h));
ny=[nyb:nye];
y=conv(x,h);

Command Window:

>> x=[3,11,7,0,-1,4,2]; nx=[-3:3];


>> h=[2,3,0,-5,2,1]; nh=[-1:4];
>> [y,ny]=conv_m(x,nx,h,nh)
y =

ny =

Hence,
y(n)= { }

3. CORRELATION

It is the measure of similarity between two sequences.

ryx(l)= y(l)*x(-l) crosscorrelation



ryx(l)= y ( n) x ( n l )
l =

rxx(l)= x(l)*x(-l) autocorrelation



rxx(l)= x ( n) x ( n l )
l =

Ex:
x(n)={ 3,11,7,0,-1,4,2 } , -3 n 3;
and y(n)= x(n-2) + w(n)
where w(n) is Gaussian sequence with mean 0 and variance 1. Crosscorrelation
between y(n) and x(n)? ryx=?

4
EEE420 Lab Handout

In matlab (command window):

% noise sequence 1
x = [3, 11, 7, 0, -1, 4, 2]; nx=[-3:3]; % given signal x(n)
[y,ny] = sigshift(x,nx,2); % obtain x(n-2)
w = randn(1,length(y)); nw = ny; % generate w(n)
[y,ny] = sigadd(y,ny,w,nw); % obtain y(n)=x(n-2)+w(n)
[x1,nx1] = sigfold(x,nx); % obtain x(-n)
[rxy,nrxy] = conv_m(y,ny,x1,nx1); % cross-correlation
subplot(2,1,1);stem(nrxy,rxy)
axis([-4,8,-50,250]);xlabel('lag variable l')
ylabel('rxy');title('Crosscorrelation: noise sequence 1')
%
% noise sequence 2
x = [3, 11, 7, 0, -1, 4, 2]; nx=[-3:3]; % given signal x(n)
[y,ny] = sigshift(x,nx,2); % obtain x(n-2)
w = randn(1,length(y)); nw = ny; % generate w(n)
[y,ny] = sigadd(y,ny,w,nw); % obtain y(n)=x(n-2)+w(n)
[x1,nx1] = sigfold(x,nx); % obtain x(-n)
[rxy,nrxy] = conv_m(y,ny,x1,nx1); % cross-correlation
subplot(2,1,2);stem(nrxy,rxy)
axis([-4,8,-50,250]);xlabel('lag variable l')
ylabel('rxy');title('Crosscorrelation: noise sequence 2')

Also, it should be noted that there is a function called xcorr for sequence
correlation computations.
>> xcorr(x,y) cross-correlation
Or
>> xcorr(x) auto-correlation
However, the xcorr function can not provide the timing information (as done by
conv_m). Because of this, we will use conv_m function.

4. DIFFERENCE EQUATION

An LTI system can also be described by a linear constant coefficient difference


equation.
M N
y(n)=
m= 0
bmx(n-m)-
k =0
aky(n-k)

to solve this equation, we have filter function.


y=filter(b,a,x)
b=[b0 b1 bM]; for x values
a=[a0 a1 .aN]; for y values

5
EEE420 Lab Handout

Ex:
y(n) - y(n-1) + 0.9y(n-2) = x(n)
a) Calculate and plot the impulse response h(n) at n=-20.120
b) Calculate and plot the unit step response s(n) at n=-20.120
c)Is the system specified by h(n) stable?

Command window:

Part a)

a=[1,-1,0.9];b=1;
x=impseq(0,-20,120);n=[-20:120];
h=filter(b,a,x);
subplot(2,1,1);stem(n,h)
axis([-20,120,-1.1,1.1])
title('Impulse Response');xlabel('n');ylabel('h(n)')

Part b)

x=stepseq(0,-20,120);
s=filter(b,a,x);
subplot(2,1,2);stem(n,s)
axis([-20,120,-.5,2.5])
title('Step Response');xlabel('n');ylabel('s(n)')


Part c) stability h( n) <

>>sum(abs(h))

Вам также может понравиться