Anda di halaman 1dari 15

EXPERIMENT NO.

1
ANALYSIS OF DISCRETE-TIME ODD AND EVEN SIGNALS
AND
DISCRETE-TIME PERIODIC AND NON-PERIODIC SIGNALS
OBJECTIVES:

The purpose of this experiment is to familiariaze the students with the basic commands in

Scilab for signal generation and for plotting the generated signal.
To generate and plot an Odd and Even Discrete-Time Signals.
To generate and plot a Periodic and Non-periodic Discrete-Time Signal.

PROCEDURE A: DISCRETE-TIME EVEN SIGNAL


1. Encode the following command:
-->n=-7:7;
-->x1=[0 0 0 1 2 3 4];
-->x=[x1,5,x1(length(x1):-1:1)];
-->a=gca();
-->a.thickness=2;
-->a.y_location="middle";
-->plot2d3(n,x);
-->xtitle('Graphical Representation of Discrete-Time Even Signal','n','x[n]');

2. Observe and draw the figure generated. ( You can use seperate paper for your explanation
and to show the result).

I observed that the code n=-7:7 indicates that the sampling at n-axis will start from -8 to 8 but
when it is an even number example n=-2:2 n-axis will be from -2 to 2. The values for x1 indicate
the values in the x[n] axis according to the arrangement of its elements inside the matrix.
Therefore, in this code x[-7,-6,-5,5,6,7]= 0, x[-4,4]=1, x[-3,3]=2, x[-2,2]=3, x[-1,1]=4 and lastly
x[0]= 5.

The symmetrical arrangement of selected sampling from -4 to 4 is made possible by


x=[x1,5,x1(length(x1):-1:1)]. The number 5 inside the bracket indicates when the x[n] axis will
stop, in this code it is 5.

3. Re-type the command but this time change x1=[0 0 0 1 2 3 4]; to x1=[1 2 3 4 0 0 0]; and
x=[x1,5,x1(length(x1):-1:1)]; to x=[x1,7,x1(length(x1):-1:1)];. What is the result? (You can use
separate paper for your explanation to show the result)

I observed that the changed code is significant in indicating the selected sampling in n-axis with
the provided value of x1 written in the code. The changed code x1=[1 2 3 4 0 0 0]; indicates that
the value of x[n] starting from -7 to -1 will be 1 2 3 4 0 0, respectively

4. Change the value of a.thickness=2; to a.thickness=5; and then remove the


a.y_location=middle; command. Run again the program. What is the result? (You can use
separate paper for your explanation and to show the result).

The thickness of the graph changes, it become thicker.


5. Change the plt2d3(n,x); to plot(n,x);. What is the result? (You can use separate paper for your
explanation and to show the result).

The significance of plot2d3(n,x) is to make the sampled data be in vertical bar not plotted point to
point or making it in discrete form.

6. Re-type again the command but change x1=[1 2 3 4 0 0 0]; to x1=[0 0 0 -1 -2 -3 -4]; and
return the value of x to x=[x1, 5, x1(length (x1) :-a.y_location=middle. What is the result?
(You can use separate paper for your explanation and to show the result).

The property of the graph changes because the axis now is in the middle. And because it is in
the middle, it can be clearly see the plotted points from -7 to -5 that is 0.

OBSERVATIONS:
1. What is the meaning and use of (a) a=gca(); (b) a.thickness=2; and (c) plot2d3(n,x);
commands?
(a) The meaning of a=gca(); is This routine returns the handle of the current axes for the
current figure. The use of it is to show the Graphic Window.
(b) a.thickness=2 is a command that controls the thickness of the lines inside the
Graphic Window and also the plot lines.
(c) plot2d3(n,x) is a command that controls how to plot the variables indicated or listed.
Also, curves are plotted using vertical bars.

PROCEDURE B: DISCRETE-TIME ODD SIGNAL


1. Type the following command and observe the result.
-->n=-5:5;
-->x1=[0 1 2 3 4 5];
-->x=[-x1($:-1:2),x1];
-->a=gca();
-->a.thickness=2;
-->a.y_location=middle;
-->a.x_location=middle;
-->plot2d3(n,x);
-->xtitle(Graphical Representation of Discrete-Time Odd Signal ,n,x[n]);

I observed that the signal signifies that the discrete signals are selected values from Odd
Signal. It is an Odd Signal because the signals are symmetric about origin.
2. Change x=[-x1($:-1:2),x1]; to x=[-x1(1:1:$),x1]; and then run again the program. What is
the result? (You can use separate paper for your explanation and to show the result.)
Nothing happens because the code that has changed is invalid to the code that executes
how to plot2d3 code.
3. Set

now

the

syntax

x=[-x(1:1:$),x1];

into

x=[-x1(2:1:$),x1];

and

then

run

again

the program. Do not include the xtitle command this time. What is the result?
(You can use separate paper for your explanation and to show the result).

The graph now indicates that is also an Odd signal because the positive side reflects the
same for negative side but upside down. Rather, the changed in code with the use of $
makes x[-1]=-5 instead of -1 compare to the earlier code.

OBSERVATIONS:
1. Is the signal generated still a discrete-time odd signal? Why?
In procedure B number 3, the signal is still discrete-time function and also an odd
signal, because half of the graph reflects the line on the right half of the graph, except
that it is upside down .
2. Explain the use of syntax x=[-x1($:-1:2),x1];.

4. Encode the following program and observe the output.


-->n=-5:5;
-->x1=[5 4 3 2 1 0]
-->x=[-x1(%s:-1:1),x1(2:1:%s)];
-->a=gca();
-->a.x_location=origin;
-->a.y_location=origin;
-->plot2d3(n,x)

The graph is not aligned properly to the axes. It is because the property indicated for the
axes is only in origin.
OBSERVATIONS:

1. Is the signal generated still a discrete-time odd signal? Add the syntax plot2d3(n,x) and
then observe the result. Is the signal generated still a discrete-time odd signal? Why?

PROCEDURE C: DISCRETE-TIME PERIODIC SIGNAL


1. Type the following command and then observe the output
-->t=1:1:50;
-->a=20*%pi*t;b=40*%pi*t;
-->x=sin(a)+cos(b);
-->subplot(2,1,1);
-->plot(t,x);//periodic continuous-time signal
-->xtitle(Graphical Representation of Periodic Continuous-Time Signal ,t,x[t]);
-->n=t;
-->fs=50;//sampling frequency
-->c=a/fs;d=b/fs;
-->y=sin(c)+cos(d);
-->subplot(2,1,2);
-->plot2d3(n,y);// periodic discrete-time signal
xtitle(Graphical Representation of Periodic Discrete-Time Signal ,n,y[n]);

Our observation is that for the values of the second graph are values that are sampled
from the first graph which is continuous signal.

2. Change the value of the sampling frequency to 30 and run again the program.
Observe the result.

Because of the change in the frequency the samples intervals become narrow. It also
because the continuous signal produces less cycle than before when it is coded to 50
frequency.

3. Now change the value of t=1:1:50 to t=1:2:100 and return the value of sampling
frequency into 50 then run again the program. Compare the result to the signal
generated in procedure1. (You can use separate paper for your explanation and to show
the result.)

The graph seemed o be indented from the left and also the t-axis adjusted up to 100
which also gives the end value for both continuous or discrete unlikely to procedure 1
because it only ends to 50 value.

PROCEDURE D: DISCRETE-TIME NON-PERIODICAL SIGNAL


1. Encode the following program and observe the output.
-->t=1:1:50;
-->a+sqrt(5)*%pi*t;b=3*t;
-->x=sin(a)+cos(b);
-->subplot (2,1,1);
-->plot (t,x);//periodic continuous-time signal
-->xtitle(Graphical Representation of Non-Periodic Continuous Time Signal ,n,y[n]);
-->n=t;
-->fs=50;//sampling frequency
-->c=a/fs;d=b/fs;
-->y=sin(c)+cos(d);
-->subplot (2,1,2);
-->plot2d3(n,y);//periodic discrete-time signal
-->xtitle(Graphical Representation of Non-Periodic Discrete Time Signal ,n,y[n]);

The graph in the first label is continuous but seems to be erotic but it became a defined
signal when it was sampled.

2. Change t=1:1:50; to t=1:1:500;. Run again the program and observe the result. (You can
use separate paper for you explanation and to show the result.)

The second graph seems not to be a non-periodic discrete time signal because of very
little amount of its interval the samples are nearer to each other. But this graph gave a
more readable values representation than in the first graph.

3. Now change the value of sampling frequency to 100. Run again the program and observe
the result. (You can use separate paper for you explanation and to show the result.)

The getting of samples become widen but not the intervals because the n-axis remain
the same. The effect of the changing of the frequency is that it gives more capabilities to
discrete time signal to get samples from the continuous signal as it can produce a much
cycles than before.

OBSERVATIONS:
1. Is the signal generated a discrete-time non periodic signal? Why.
2. What is the effect of varying the sampling frequency of the given signal?

ANSWERS TO THE REPORT:

1. What is the general formula that will describe the EVEN discrete-time function?
2. What is the general formula that will describe the ODD discrete-time function?
3. Compare a discrete-time periodic signal to a discrete-time non-periodic signal?
4. From procedure C and D, how do we convert a continuous-time signal into a discretetime signal?

TECHNICAL DISCUSSION
Through this experiment we have familiarized ourselves to basic commands in SciLab application
particularly in the codes involving continuous and discrete time graphs. There are lots of
procedures that have distinct properties in plotting that helps us to compare and observe the
results.
In Procedure A, which contains basic codes for plotting, we observed the characteristic of the
following codes; n=-7:7 this code is basically for the n-axis of the graph which also commonly
known as x-axis. It ends the counting of n-axis to whatever it is indicated, i.e. n=-8:8 therefore naxis will display numbers from -8 to 8 but this is only true for any assigned even numbers
because when it is an odd number it increment first before the end points, i.e. n=-1:1 the

counting is from -2 to 2. The code a=gca(); let the graphing window appear and also let us change
the properties of the graph for example a.thickness=2 the usual thick of the lines will be doubled.
Also we observed that all the graphs that we coded are an even discrete signal. Lastly, we
observed that the use of plot2d3 makes a discrete time signal because it creates vertical bars.
In Procedure B, the most focus in this is the code using $ when we try to change the values from
the given code x=[-x1($:-1:2),x1] instead of -1 and 2 we replace it to 1 and 1 and many more
combination of numbers, there will be nothing in the graphing window. Because x1 indicates
that we take the negation of elements in the given matrix, $ indicates that we first take the
element in the last column which is 5, then -1 indicates that in order to get the next value it is
needed to be decremented by 1, lastly 2 will indicate that the counting will end to its next value.
Also we observed that we created an odd discrete signal.
In Procedure C, it is more concern with the codes that plotting continuous signal and get
samples from it periodically or at regular intervals. In this procedure when we changed
t=1:1:50; to t=1:1:100; the graph has indented to the left and also the ending value for the
continuous signal and also for discrete time periodic signal is at 100 instead of 50.
In Procedure D, when we changed the value of the frequency into much higher value the samples
become nearer with each other but the getting of samples are not at regular intervals. It looks
just like a better version for the distorted continuous signal given in the first label. Also we
observed that the use of subtotal command let the graphing window be divided to whether it is
indicated in the code in order to get different graphs at the same time inside the graphing
window.

Anda mungkin juga menyukai