Digital Signal Processing Reference
In-Depth Information
function LVScCosine(A,N,F)
% LVScCosine(1,128,3)
% LVScCosine(2,128,3)
t = [0:1:N-1]/N; x = [A*cos(2*pi*F*t)]; y = 2*x;
subplot(2,1,1); stem(x); subplot(2,1,2); stem(y)
Shift invariance can be demonstrated by delaying the input signal and noting that the output is
just a shifted version of the output corresponding to the undelayed input signal. For example, we can
write a script similar to the above one that inserts a delay Del (a number of samples valued at zero) before
the cosine sequence. The reader should run both of the calls given in the script below to verify the shift
invariance property.
function LVScDelCosine(A,N,F,Del)
% LVScDelCosine(1,128,3,0)
% LVScDelCosine(1,128,3,30)
t = [0:1:N-1]/N;x=[zeros(1,Del),A*cos(2*pi*F*t)];
y = 2*x; figure(14); subplot(2,1,1);
stem(x); subplot(2,1,2); stem(y)
We now provide a script that will implement a simple LTI system based on scaling and delaying
an input signal multiple times and adding the delayed, scaled versions together. The input argument
LT ICoeff is a row vector of coefficients, the first one of which weights the input signal, x
[
n
]
, the
second one of which weights the input signal delayed by one sample, i.e., x
[
n
1
]
, and so on.
function [yC,nC] = LV_LTIofX(LTICoeff,x)
% [yC,nC] = LV_LTIofX([1,-2,1],cos(2*pi*12*[0:1:63]/64) )
x1 = LTICoeff(1)*x;
nC = [0:1:length(x1)-1]; yC = x1;
if length(LTICoeff ) < 2
return; end
for LTICoeffCtr = 2:1:length(LTICoeff )
xC = [LTICoeff(LTICoeffCtr)*x];
newnC = [0:1:length(xC)-1] + (LTICoeffCtr-1);
[yC, nC] = LVAddSeqs(yC,nC,xC,newnC); end
Example 2.2.
If x = cos ( 2 π
[
0
:
1
:
63
]
/ 64 ) , compute y
[
n
]
for the LTI system defined by
[
]=
=
[
]−
[
]
y
n
LT I (x)
2 x
n
x
n
1
We make the call
[yC,nC] = LV_LTIofX([2,-1],cos(2*pi*[0:1:63]/64)); stem(nC,yC)
the results of which are shown in Fig. 2.16.
Example 2.3. In this example, we will see how a simple LTI system can have a frequency-selective
capability. Determine the response y
[
n
]
of the LTI system defined as
y
[
n
]=
0 . 1 x
[
n
]−
x
[
n
1
]+
x
[
n
2
]−
0 . 1 x
[
n
3
]
Search WWH ::




Custom Search