Sunteți pe pagina 1din 19

UNIVERSITY OF THE EAST

COLLEGE OF ENGINEERING
ECE DEPARTMENT

NEC 416 / ECE1


THU / 1:00 2:30, 4:00-5:30 / DB LAB A

EXPERIM ENT NO.1


ANALYSIS OF DISCRETE-TIM E ODD AND EVEN SIGNALS AND DISCRETETIM E PERIODIC AND NON-PERIODIC SIGNALS

ALIH, ALM UZREEN R.

ENGR. SHERALYN B. AVENDAO

20130120762
JULY 14, 2016

BALANA, VINADHEL DIANNE C.


20130137858

EXPERIM ENT NO. 1: ANALYSIS OF DISCRETE-TIM E ODD AND EVEN


SIGNALS AND DISCRETE-TIM E PERIODIC AND NONPERIODIC SIGNALS

OBJECTIVES:

The purpose of this experiment is to familiarize 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 Signals.

PROCEDURE A: DISCRETE-TIM E 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.

After the execution of the code, a graphic window appears. It


shows a 2 dimensional graph with a title at the top. The vertical interval
for the graph is 0,5. The values are represented by a vertical bar. In the
left side, the x[n] values are 0,0,0,1,2,3 and 4 in an orderly manner. The
right side is a symmetry of the left side at the vertical axis. A Discrete time Even signal has just been shown.

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?

In the left side, the x[n] values becomes 1,2,3,4,0,0 and 0 in an


orderly manner. The right side is a symmetry of the left side at the
vertical axis. The vertical interval for the graph is 0,7.

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?

The thickness of the representation of the axes increases.


Removing the a.y location="middle" puts the vertical axis on the left.

5. Change the plot2d3(n,x); to plot(n,x); .What is the result?

A line that connects every two consecutive points appears.

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):-1:1)];. Also, add the syntax a.x_location="middle";
after the a.y_location="middle";. What is the result?

The sampling points have changed. Both axes are alligned at the
center. The vertical interval for the graph is -5,5.

PROCEDURE B: DISCRETE-TIM E 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]');

In the left side, the x[n] values are -5,-4,-3,-2, and -1 in an orderly
manner. The right side is a symmetry of the left side at the origin. A
Discrete-time Odd signal has just been shown.

2. Change x=[-x1($:-1:2), x1]; to x=[-x1(1:1:$), x1]; and then run


again the program. What is the result?
An error 999 has appeared. This is because of the input
arguments. The x=[-x1(1:1:$), x1] is equal to (0,-1,-2,-3,-4,-5,0,1,2,3,4,5)
which has 12 values. It cannot be shown because n is defined as -5:5 so
the graphic window can only show 11 values for n.
3. Set now the syntax x=[-x1(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?

In the left side, the x[n] values are -1,-2,-3,-4, and -5. In right side,
the x[n] values are 1,2,3,4, and 5.
OBSERVATION:
1. Is the signal generated still a discrete-time odd signal? Why?
The signal generated is no longer disrete-time odd signal
because there is no symmetry at the origin.

2. Explain the use of the syntax x=[-x1(2:1:$), x1];.


x1($:-1:2) will create a matrix based on x1. The "$"
represents last index of x1 which is 5. The "-1" is the interval.
The "2" will determine the last number of the list of values. The
last value will be 2-1=1. Hence, the formula is: ($,$-1,$-2...2-1).
So, for x1($:-1:2), the values will be (5, 4, 3, 2, 1).
Substituting the values for the whole syntax x=[-x1($:1:2), x1];, we will get: (-5,-4,-3,-2,-1,0,1,2,3,4,5)

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 x[n} values from left to right are -1,-2,-3,-4,-5,4,3,2 and 1.


Both axes are centered.

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?

The generated signal is no longer a discrete-time odd


signal because there is a point (0,-5) at the origin.

PROCEDURE C: DISCRETE-TIM E 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 ContinuousTime
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
Time
','n','y[n]');

DiscreteSignal

Two signals appear. The first subplot has axes x[t] and t while the
second one has y[n] and n. The origins are placed in the left. By looking
at the first subplot, we can't really identify if its periodic. It has no
repetitive pattern. It is also weird that the x[t] axis has three 1s.
However, the second subplot looks to have a repetitive pattern. The
graph interval for t is from 0 to 50.

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

The difference from the previous one is that the second subplot has
a more frequent repetitive pattern.

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 procedure 1.

The new figure still has 10 repetitive patterns but there is a


difference in the peaks. The graph interval for t is now from 0 to 100.

PROCEDURE D: DISCRETE-TIM E NON-PERIODIC 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',
'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
Non-Periodic
Discrete-Time
Signal',
'n',
'y[n]');

The first subplot has axes x[t] and t while the second one has y[n]
and n. The two signals are clearly not periodic.

2. Change t=1:1:50; to t=1:1:500;. Run again the program and observe the
result.

An enlarged window view:

The graph interval for t is now from 0 to 500.

3. Now change the value of sampling frequency to 100. Run again the
program and observe the result.

An enlarged window view:

The second subplot has changed.

OBSERVATIONS:
1. Is the signal generated a discrete-time non-periodic signal? Why?
Yes, it is a discrete-time non-periodic signal. There is are no
repetitive patterns.
2. What is the effect of varying the sampling frequency of the given
signal?
Based on the plots, varying it will only change the amplitude of
the signal at any instant.

ANSW ERS TO THE REPORT


1. What is the general formula that will describe the EVEN discrete -time
function?

x[n] = x[-n]
2. What is the general formula that will describe the ODD discrete -time
function?

x[n] = -x[-n]
3. Compare a discrete time periodic signal to a discrete-time non-periodic
signal?
For a discrete periodic signal, it satifies the equation x[n] = x[n+N],
while for a discrete time non-periodic signal it does not satisfy that
equation.

4. From procedure C and D, how do we convert a continuous time signal


into a discrete-time signal?
We convert continuous time signal into a discrete-time signal by
dividing the signal frequency by the sampling frequency of the funtion
and using plot2d3( ) command instead of plot( ) command.

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