0% found this document useful (0 votes)
33 views12 pages

DSP Lab 3

This document discusses various topics related to digital signal processing including: 1. Z-transforms and inverse Z-transforms for analyzing discrete-time signals in the Z-domain. 2. Pole-zero diagrams which help visualize the poles and zeros of a system function in the Z-domain. 3. The discrete Fourier transform (DFT) and inverse DFT for transforming between time and frequency domains. 4. The fast Fourier transform (FFT) algorithm and examples of its implementation for computing the DFT of discrete-time signals efficiently.

Uploaded by

Mekonen Abera
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)
33 views12 pages

DSP Lab 3

This document discusses various topics related to digital signal processing including: 1. Z-transforms and inverse Z-transforms for analyzing discrete-time signals in the Z-domain. 2. Pole-zero diagrams which help visualize the poles and zeros of a system function in the Z-domain. 3. The discrete Fourier transform (DFT) and inverse DFT for transforming between time and frequency domains. 4. The fast Fourier transform (FFT) algorithm and examples of its implementation for computing the DFT of discrete-time signals efficiently.

Uploaded by

Mekonen Abera
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/ 12

DSP LAB-3 CONTENTS

 Z-transform and Inverse Z-transform


 Pole-zero Diagrams for a Function in Z-
Domain
 DFT and IDFT of DT Signals
 Implementation of FFT of DT Signals
Finding Z-Transform of a given sequence
%Taking the z-transform of the discrete
sequence
clc;
clear all;
close all; syms z;
x=[2 4 6 2 4 1];
n=length(x);
for i=1:n;
z_x(i)=(x(i)*z^-(i-1));
end
a=sum(z_x);
disp(a);
pretty(a)
Finding Z-Transform of a power series sequence
>> syms n; syms n a;
>> x(n)=0.5^n; x(n)=(a)^n;
a=ztrans(x(n)) b=ztrans(x(n))
a=z/(z - 1/2)
b = -z/(a - z)
>> pretty(a)
z >> pretty(b)
-------
z - 1/2 z
- -----
a - z
More on z-transform
>> close all syms n a;
>> clear all >> x=n*(a^n);
>> syms n w0; >> d=ztrans(x);
>> x=sin(w0*n); d=(a*z)/(a -z)^2
>> c=ztrans(x); >> pretty(d)
>> pretty(c)
z sin(w0) a z
------------------- --------
2 2
z - 2 cos(w0) z + 1 (a - z)
Find Inverse Z-Transform
>> syms n z;
x(z)=(1+3*(z^-1))/(1+3*(z^-1)+2*(z^-
2));
x(n)=iztrans(x)
x(n)=2*(-1)^n - (-2)^n

>> syms n z;
>> x(z)=z/(z-0.5);
>> x(n)=iztrans(x(z))
x(n)=(1/2)^n
Plot Pole-zero diagram in Z-Domain
%Finding the residues, poles and direct
terms of the partial-fraction expansion
b=[2 1 -2];
a=[1 1 -2];
[r,p,k]=residuez(b,a);
z=roots(b);
p=roots(a);
zplane(b,a)
grid on
title('Plot pole-zero diagram on z-plane')
More on Pole-zero diagram in z-domain
%Pole-zero diagram in z-plane
%Given D.E y(n)-3/4y(n-1)+1/8y(n-2)=x(n)-x(n-1)
%Taking z-transform on both sides and
find the impulse response H(z)=Y(z)/X(z)
%H(z)=(1-z^-1)/(1-3/4z^-1+1/8z^-2)
b=[1 -1];%numerator
a=[1 -3/4 1/8];%denumerator
zplane(b,a)%compute and display the
pole-zero diagram
z=roots(b); %to display the zero values
p=roots(a); %to display the pole values
Finding DFT of a given sequence
%Computation of N-ponit DFT of a given sequence
%Plotting the magnitude and phase spectrum
N=input('Enter the N values of N-point DFT N=
');
X=input('Enter the sequence to be calculated X= ');
n=[0:1:N-1]; k=[0:1:N-1]; WN=exp(-1j*2*pi/N);
nk=k'*n; WNnk=WN.^nk; Xk=X*WNnk;
magX=abs(Xk);%Magnitude of the calculated DFT
phaseX=angle(Xk)*180/pi;%Phase of calculated DFT
subplot(2,1,1); plot(k,magX);
title('Plotting Magnitude of calculated DFT');
subplot(2,1,2); plot(k,phaseX,'r');
title('Phase spectrum of the calculated DFT');
disp('The calculated DFT is =');Xk;
Finding IDFT of a given sequence
>> DFT
Enter the N values of N-point DFT N= 4
Enter the sequence to be calculated X=
[1 2 3 4]
The calculated DFT is =Xk
>> disp(Xk)
10.0000 + 0.0000i -2.0000 + 2.0000i
-2.0000 - 0.0000i -2.0000 - 2.0000i
>>a=ifft(Xk);
>> disp(a)
1.0000 - 0.0000i 2.0000 - 0.0000i
3.0000 + 0.0000i 4.0000 + 0.0000i
Implementation of FFT of DT signals
% Computation of FFT for defined
sequence
x=[0 1 2 3 4 5 6 7]; %Given sequence
n=0:7; %Length of given sequence
a=fft(x); %FFT of x
disp(a)
>> x=[1 0 1 0 1 0 1 0];
>> n=0:7;
>> b=fft(x);
>> disp(b)
4 0 0 0 4 0 0 0
>> c=ifft(b);
>> disp(c)
1 0 1 0 1 0 1 0
More on FFT Analysis
%Computation of Fast Fourier Transform
clc; clear all; close all;
x=input('ENTER THE SEQUENCE X= ');
n=input('ENTER THE LENGTH OF THE SEQUENCE N= ');
disp('Fourier Transformed signal is X');
X=fft(x,n);
subplot(2,1,1);
stem(x); xlabel('n...>');ylabel('x(n)...>');
title('INPUT SIGNAL');
subplot(2,1,2);
stem(X,'r'); xlabel('Real axis....>');
ylabel('Imaginary axis...>>');
title('FFT of x');
grid on
TH E
O F
END E
I D
SL U!
YO
N K
H A
T

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy