Sunteți pe pagina 1din 10

EXPERIMENT NO.

3
DISCRETE-TIME CONVOLUTION AND Z-TRANSFORM
OBJECTIVES:

To generate and plot a discrete-time convolution signals and z-transform signals


To analyze the properties of convolution on its discrete-time and z-transform signals
To determine the region of convergence (ROC) of a rational z-transform

PROCEDURE A: CONVOLUTION OF A DISCRETE-TIME SIGNAL


1. Encode the following command.
CODE:
h=[3 2 1 -2 1 0 -4 0 3]; //Impluse Response//
n=0:8;
subplot(3,1,1);
plot2d3(n,h);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
x=[1 -2 3 -4 3 2 1]; //Input Sequence//
n=0:6;
subplot(3,1,2);
plot2d3(n,x);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
y=convol(h,x)
n=0:14;
subplot(3,1,3);
plot2d3(n,y);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
title('Output Obtained by Convolution');

2. Observe and draw the figure generated.


OUTPUT:

The first graph shows the impulse response discrete sample of h=[3 2 1 -2 1 0 -4 0 3]
from n=0 to 8. The second graph shows the input sequence x=[1 -2 3 -4 3 2 1] from n=0 to 6. As
the output, as shown in the third graph, obtained by convolution the value of n became 0 to 14 which is
the sum of n from the first two graphs.

OBSERVATIONS:
1. Modify program 1 to develop a convolution of a length-15 sequence h[n] with a length-10 sequence
x[n].
CODE:
h=[round(10*rand(0:15)-5)]; //Impluse Response//
n=0:15;
subplot(3,1,1);
plot2d3(n,h);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
x=[round(10*rand(0:10)-5)]; //Input Sequence//
n=0:10;
subplot(3,1,2);
plot2d3(n,x);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
y=convol(h,x)

n=0:25;
subplot(3,1,3);
plot2d3(n,y);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
title('Output Obtained by Convolution');

OUTPUT:

The first graph shows a length-15 sequence h[n]. The second graph shows a length-10 sequence
x[n], both graphs have random samples. As the output, as shown in the third graph, obtained by
convolution the value of n became 0 to 25 which is the sum of n from the first two graphs.
2. Modify program 1 to develop a convolution of a length-19 sequence h[n] with a length-13 sequence
x[n].
CODE:
h=[round(10*rand(0:19)-5)]; //Impluse Response//
n=0:19;
subplot(3,1,1);
plot2d3(n,h);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
x=[round(10*rand(0:13)-5)]; //Input Sequence//
n=0:13;
subplot(3,1,2);

plot2d3(n,x);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
y=convol(h,x)
n=0:32;
subplot(3,1,3);
plot2d3(n,y);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
title('Output Obtained by Convolution');

OUTPUT:

The first graph shows a length-19 sequence h[n]. The second graph shows a length-13 sequence
x[n], both graphs have random samples. As the output, as shown in the third graph, obtained by
convolution the value of n became 0 to 32 which is the sum of n from the first two graphs.
3. Modify program 1 to develop a convolution of a length-23 sequence h[n] with a length-16 sequence
x[n].
CODE:
h=[round(10*rand(0:23)-5)]; //Impluse Response//
n=0:23;
subplot(3,1,1);
plot2d3(n,h);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
x=[round(10*rand(0:16)-5)]; //Input Sequence//
n=0:16;
subplot(3,1,2);
plot2d3(n,x);
mtlb_grid;

ylabel('Amplitude'); xlabel('Time Index n');


y=convol(h,x)
n=0:39;
subplot(3,1,3);
plot2d3(n,y);
mtlb_grid;
ylabel('Amplitude'); xlabel('Time Index n');
title('Output Obtained by Convolution');

OUTPUT:

The first graph shows a length-23 sequence h[n]. The second graph shows a length-16 sequence
x[n], both graphs have random samples. As the output, as shown in the third graph, obtained by
convolution the value of n became 0 to 39 which is the sum of n from the first two graphs.

PROCEDURE B: Z-TRANSFORMATION (Chirp z-transform Algorithm)


1. Encode the following command:
CODE:
a=.7*exp(%i*%pi/6);
[ffr,bds]=xgetech();//preserve current context
rect=[-1.2,-1.2*sqrt(2),1.2,1.2*sqrt(2)];
t=2*%pi*(0:179)/179;xsetech([0,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect);
plot2d([0 real(a)]',[0 imag(a)]',[3],"000");
xsegs([-1.0,0;1.0,0],[0,-1;0,1.0]);
w0=.93*exp(-%i*%pi/15);w=exp(-(0:9)*log(w0));z=a*w;

zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000");
xsetech([0.5,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect);
plot2d([0 real(a)]',[0 imag(a)]',[-1],"000");
xsegs([-1.0,0;1.0,0],[0,-1;0,1.0]);
w0=w0/(0.93*0.93);w=exp(-(0:9)*log(w0));z=a*w;
zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000");
xsetech(ffr,bds);//restore context;

2. Observe and draw the figure generated.


OUTPUT:

3. Add a negative sign on the value .7 in the syntax a=.7*exp(%i*%pi/6);. What is the result?
CODE:
a=-.7*exp(%i*%pi/6);
[ffr,bds]=xgetech();//preserve current context
rect=[-1.2,-1.2*sqrt(2),1.2,1.2*sqrt(2)];
t=2*%pi*(0:179)/179;xsetech([0,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect);
plot2d([0 real(a)]',[0 imag(a)]',[3],"000");
xsegs([-1.0,0;1.0,0],[0,-1;0,1.0]);
w0=.93*exp(-%i*%pi/15);w=exp(-(0:9)*log(w0));z=a*w;
zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000");
xsetech([0.5,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect);
plot2d([0 real(a)]',[0 imag(a)]',[-1],"000");
xsegs([-1.0,0;1.0,0],[0,-1;0,1.0]);
w0=w0/(0.93*0.93);w=exp(-(0:9)*log(w0));z=a*w;
zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000");
xsetech(ffr,bds);//restore context;
clc

OUTPUT:

4. Replace the value .7 into 1.9 in the syntax a=.7*exp(%i*%pi/6); and then re-type again the
program. What is the result?
CODE:
a=1.9*exp(%i*%pi/6);
[ffr,bds]=xgetech();//preserve current context
rect=[-1.2,-1.2*sqrt(2),1.2,1.2*sqrt(2)];
t=2*%pi*(0:179)/179;xsetech([0,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect);
plot2d([0 real(a)]',[0 imag(a)]',[3],"000");
xsegs([-1.0,0;1.0,0],[0,-1;0,1.0]);
w0=.93*exp(-%i*%pi/15);w=exp(-(0:9)*log(w0));z=a*w;
zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000");
xsetech([0.5,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect);
plot2d([0 real(a)]',[0 imag(a)]',[-1],"000");
xsegs([-1.0,0;1.0,0],[0,-1;0,1.0]);
w0=w0/(0.93*0.93);w=exp(-(0:9)*log(w0));z=a*w;
zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000");
xsetech(ffr,bds);//restore context;
clc

OUTPUT:

5. Replace the value 6 to 2 in the syntax a=.7*exp(%i*%pi/6); and then re-type again the program.
What is the result?
CODE:
a=-.7*exp(%i*%pi/2);
[ffr,bds]=xgetech();//preserve current context
rect=[-1.2,-1.2*sqrt(2),1.2,1.2*sqrt(2)];
t=2*%pi*(0:179)/179;xsetech([0,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect);
plot2d([0 real(a)]',[0 imag(a)]',[3],"000");
xsegs([-1.0,0;1.0,0],[0,-1;0,1.0]);
w0=.93*exp(-%i*%pi/15);w=exp(-(0:9)*log(w0));z=a*w;
zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000");
xsetech([0.5,0,0.5,1]);
plot2d(sin(t)',cos(t)',[2],"012",' ',rect);
plot2d([0 real(a)]',[0 imag(a)]',[-1],"000");
xsegs([-1.0,0;1.0,0],[0,-1;0,1.0]);
w0=w0/(0.93*0.93);w=exp(-(0:9)*log(w0));z=a*w;
zr=real(z);zi=imag(z);
plot2d(zr',zi',[5],"000");
xsetech(ffr,bds);//restore context;
clc

OUTPUT:

OBSERVATIONS:
1. What is the used of xgetech(), xsetech and xsegs syntax in the program?
2. Compare it to the result of the ROCs obtained from the program.

Answers:

1.

xsetech
xgetech

: to set graphic context values


: to get information on the current graphic context

xsegs: draws a set of unconnected segments.

2.
ANSWERS TO THE REPORT:
1. How does the convolution of the given impulse response and input sequence is obtained in procedure
A?
2. In what application does a chirp z-transform algorithm is used?
3. What factor determines the region of convergence (ROC) of z-transform?
Answers:
1. The output convolution was obtained in procedure A by blending one function to another which is the
given impulse response and input sequence functions.
2.

S-ar putea să vă placă și