0% found this document useful (0 votes)
43 views16 pages

8 Lecture DSP: BITS Pilani

The document discusses the one-sided z-transform and its shifting property. It then provides an example of solving a difference equation using the z-transform. Specifically, it solves the difference equation y(n) - 3/2y(n-1) + 1/2y(n-2) = x(n) where x(n) is given. It expresses the solution in various forms including the homogeneous and particular parts, transient and steady-state responses, and zero-input and zero-state responses. Matlab code is provided to verify the solution.

Uploaded by

rktiwary256034
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views16 pages

8 Lecture DSP: BITS Pilani

The document discusses the one-sided z-transform and its shifting property. It then provides an example of solving a difference equation using the z-transform. Specifically, it solves the difference equation y(n) - 3/2y(n-1) + 1/2y(n-2) = x(n) where x(n) is given. It expresses the solution in various forms including the homogeneous and particular parts, transient and steady-state responses, and zero-input and zero-state responses. Matlab code is provided to verify the solution.

Uploaded by

rktiwary256034
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

BITS Pilani

Pilani Campus

8th Lecture DSP


The One-sided z Transform

The one-sided z-transform of a sequence x(n) is given by

Shifting Property
Z+ [x(n k)] = Z [x(n k)u(n)]

or

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Solve: y(n) 3/2y(n 1) + 1/2y(n 2) = x(n), n 0 where
x(n) =

Y+(z) 3/2[y(1)+z1Y +(z)]+1/2[y(2)+z1y(1)+z2Y +(z)]


=

Substituting the initial conditions and rearranging,

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


After inverse transformation the solution is

Matlab Implementation

b = [2 -9/4 1/2]; a=[1 -7/4 7/8 -1/8];

[r p c]= residuez(b,a)
4
Forms of the solutions
The preceding solution is the complete response of the
difference equation. It can be expressed in several forms.
Homogeneous and particular parts:

The homogeneous part is due to the system poles, and the


particular part is due to the input poles.
Transient and steady-state responses:

The transient response; poles inside the unit circle,


Steady state response poles on unit circle
Poles outside the unit circle : Unbounded response
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Zero-input (or initial condition) and zero-state responses

A
The eqn has two parts. The first part can be interpreted as
YZS(z) = H(z)X(z) zero-state responses: &
the second part as YZI(z) = H(z)XIC(z)
Solving for both the parts independently
In this example xIC(n) is xIC(n) = {1,2}

Now taking the inverse z-transform of each part of (A), we


write the complete response as

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Matlab implementation
Use b=1; a= [1 -3/2 1/2];
n=[0:7]; x= (1/4).^n; xic = [1, -2 ];
y1 = filter(b,a,x,xic)

Verification for
y2 = (1/3)*(1/4).^n+(1/2).^n+(2/3)*ones(1,8)
& For

y2 = (1/3)*(1/4).^n-2*(1/2).^n+(8/3)*ones(1,8) + 3*(1/2).^n
- 2*ones(1,8);
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
A periodic square wave sequence is given by

Where, m=0,

where N is the fundamental period and L/N is the duty cycle.


a. Determine an expression for [X (k)] in terms of L and N.
b. Plot the magnitude [X(k)] for L = 5, N = 20; L = 5, N = 40; L = 5,
N = 60; and L = 7, N = 60.
c. Comment on the results.

8
By applying the analysis equation

or the magnitude of X(k) is given by

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


The MATLAB script for L = 7 and N = 60:
L = 7; N = 60; k = [-N/2:N/2]; % Sq wave parameters
xn = [ones(1,L), zeros(1,N-L)]; % Sq wave x(n)
Xk = dfs(xn,N);
magXk = abs([Xk(N/2+1:N) Xk(1:N/2+1)]);
subplot(2,2,4); stem(k,magXk); axis([-N/2,N/2,-0.5,7.5])
xlabel('k'); ylabel('Xtilde(k)')
title('DFS of SQ. wave: L=7, N=60')

Observations:
DFS coefficients of square waves look like sinc
functions
The amplitude at k = 0 is equal to L,
zeros of the functions are at multiples of N/L
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
Aliasing Effect example: Frequency Sampling
If x(n) is time-limited (i.e., of finite duration) to [0,N 1],
then N samples of X(z) on the unit circle determine X(z) for
all z.

x(n) =
Or

Let x1(n) = [6, 5, 4, 3, 2, 1]. Its DTFT X1(ej) is sampled at

to obtain a DFS sequence X2(k). Determine the sequence


x2(n), which is the inverse DFS of X2(k).

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


Implies

Thus
Thus x(4) is aliased into x(0), and x(5) is aliased into x(1).
Hence
x2(n) = [. . . , 8, 6, 4, 3, 8, 6, 4, 3, 8, 6, 4, 3, . . .}

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956


This example shows the use of the FFT function for spectral analysis. A
common use of FFT's is to find the frequency components of a signal
buried in a noisy time domain signal.

First create some data


= 0:.001:.25; x = sin(2*pi*50*t) + sin(2*pi*120*t);
Add some random noise with a standard deviation of 2 to
produce a noisy signal y. Take a look at this noisy signal y by
plotting it.
y = x + 2*randn(size(t));
subplot(2,2,1) ,
plot(y(1:50)); title('Noisy time domain signal')
the fast-Fourier transform (FFT). Y = fft(y,251);

13
Compute the power spectral density, a measurement of the energy at various
frequencies, using the complex conjugate (CONJ). Form a frequency axis for the first
127 points and use it to plot the result. (The remainder of the points are symmetric.)

Pyy = Y.*conj(Y)/251; f = 1000/251*(0:127);


subplot(2,2,2);
plot(f,Pyy(1:128)) ;
title('Power spectral density') ; xlabel('Frequency (Hz)')
Zoom in and plot only up to 200 Hz. Notice the peaks
at 50 Hz and 120 Hz. These are the frequencies of the
original signal.
subplot(2,2,3)
plot(f(1:50),Pyy(1:50));
title('Power spectral density');
xlabel('Frequency (Hz)')
14
Let x(n) = 10(0.8)n , 0 n 10.
a. Determine and plot x ((n))11.
b. Verify the circular folding property

MATLAB script: ( a)

n = 0:100; x = 10*(0.8) .^ n; y = x(mod(-n,11)+1);


subplot(2,1,1); stem(n,x); title(Original sequence)
xlabel(n); ylabel(x(n));
subplot(2,1,2); stem(n,y); title(Circularly folded sequence)
xlabel(n); ylabel(x(-n mod 10));
MATLAB script: ( b)

n = 0:10; x = 10*(0.8) .^ n; y = x(mod(-


n,11)+1);
X = dft(x,11); Y = dft(y,11);
subplot(2,2,1); stem(n,real(X));
title(Real{DFT[x(n)]}); xlabel(k);
subplot(2,2,2); stem(n,imag(X));
title(Imag{DFT[x(n)]}); xlabel(k);
subplot(2,2,3); stem(n,real(Y));
title(Real{DFT[x((-n))11]}); xlabel(k);
subplot(2,2,4); stem(n,imag(Y));
title(Imag{DFT[x((-n))11]}); xlabel(k);
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

You might also like