Ee343 signals and systems - lab 1 - loren schwappach

2
CTU: EE 343 Signals and Systems: Lab 1: Continuous and Discrete Time Signals in MATLAB 1 Colorado Technical University EE 343 Signals and Systems Lab 1: Continuous and Discrete Time Signals May 2010 Loren Schwappach ABSTRACT: This lab report was completed as a course requirement to obtain full course credit in EE343, Signals and Systems at Colorado Technical University. This lab report examines the basic operations of MATLAB via the creation of several continuous-time and discrete-time signals. If you have any questions or concerns in regards to this laboratory assignment, this laboratory report, the process used in designing the indicated circuitry, or the final conclusions and recommendations derived, please send an email to [email protected] . All computer drawn figures and pictures used in this report are of original and authentic content. I. INTRODUCTION MATLAB is a powerful program and is useful in the visualization of mathematics, physics, and applied engineering. In this lab exercise MATLAB will be used to compute and visualize discrete-time and continuous-time signals. II. PROCEDURES This lab begins with the creation of the discrete-time step function: To create this discrete time function in MATLAB, individual values are defined at each time and inserted into a MATLAB array. These values used must be numerous enough to efficiently describe the function with great accuracy, and for our first function, 9 values were placed within an array. The second objective of this lab is to develop and plot the continuous-time sinusoidal function: To create this function in MATLAB a variable name is created and equated to the function. In the above case the function y[t] is a combination of two added cosine functions. The final objective of this lab is to develop a discrete- time representation of the continuous-time function mentioned previously. III. RESULTS For the discrete-time function: , the following code was input into MATLAB: %Setup a matrix of discrete values ones and zeros. %The graph starts at t=1 so four zeros are required. >> stepfn =[zeros(1,4),ones(1,5)] stepfn = 0 0 0 0 1 1 1 1 1 %Multiply all values by 4. >> Y = 4*stepfn Y = 0 0 0 0 4 4 4 4 4 >> stem(Y) Figure 1: Discrete-time step function As can be seen by figure 1, the function is a discrete- time representation of a step function with a height of 4.

description

 

Transcript of Ee343 signals and systems - lab 1 - loren schwappach

Page 1: Ee343   signals and systems - lab 1 - loren schwappach

CTU: EE 343 – Signals and Systems: Lab 1: Continuous and Discrete Time Signals in MATLAB 1

Colorado Technical University EE 343 – Signals and Systems

Lab 1: Continuous and Discrete Time Signals May 2010

Loren Schwappach

ABSTRACT: This lab report was completed as a course requirement to obtain full course credit in EE343, Signals and Systems at Colorado Technical University. This lab report examines the basic operations of MATLAB via the creation of several continuous-time and discrete-time signals. If you have any questions or concerns in regards to this laboratory assignment, this laboratory report, the process used in designing the indicated circuitry, or the final conclusions and recommendations derived, please send an email to [email protected]. All computer drawn figures and pictures used in this report are of original and authentic content.

I. INTRODUCTION

MATLAB is a powerful program and is useful in the

visualization of mathematics, physics, and applied

engineering. In this lab exercise MATLAB will be used to

compute and visualize discrete-time and continuous-time

signals.

II. PROCEDURES

This lab begins with the creation of the discrete-time step function:

To create this discrete time function in MATLAB,

individual values are defined at each time and inserted into a MATLAB array. These values used must be numerous enough to efficiently describe the function with great accuracy, and for our first function, 9 values were placed within an array.

The second objective of this lab is to develop and

plot the continuous-time sinusoidal function:

To create this function in MATLAB a variable name is created and equated to the function. In the above case the function y[t] is a combination of two added cosine functions.

The final objective of this lab is to develop a discrete-

time representation of the continuous-time function mentioned previously.

III. RESULTS

For the discrete-time function: , the following code was input into MATLAB: %Setup a matrix of discrete values ones and zeros. %The graph starts at t=1 so four zeros are required. >> stepfn =[zeros(1,4),ones(1,5)] stepfn = 0 0 0 0 1 1 1 1 1 %Multiply all values by 4. >> Y = 4*stepfn Y = 0 0 0 0 4 4 4 4 4 >> stem(Y)

Figure 1: Discrete-time step function

As can be seen by figure 1, the function is a discrete-

time representation of a step function with a height of 4.

Page 2: Ee343   signals and systems - lab 1 - loren schwappach

CTU: EE 343 – Signals and Systems: Lab 1: Continuous and Discrete Time Signals in MATLAB 2

For the continuous-time function: , the following MATLAB code was used. >> t = 0:.00001:.1; >> w0 = 2*pi; >> Y1 = (cos(w0*50*t)); >> Y2 = 2*cos(w0*100*t); >> Y = Y1 + Y2; >> plot(t,Y1,'--', t,Y2,':', t,Y,'-');

Figure 2: Continuous-time functions

Finally, the continuous-time function Y in figure 2

above can now be represented in MATLAB by: >> t = 0:.001:.1; >> w0 = 2*pi; >> Y1 = (cos(w0*50*t)); >> Y2 = 2*cos(w0*100*t); >> Y = Y1 + Y2; >> stem(t,Y);

Figure 3: Discrete-time representation of y[t]

IV. EVALUATION

. Developing the continuous-time and discrete-time signals in MATLAB was an easy task and no difficulties were encountered. I was able to plot multiple cosine functions within the same graph as shown in figure 2. All plots were smooth and easy to manipulate.

V. CONCLUSIONS

. MATLAB is a great utility for representing complex

concepts visually and can easily be manipulated to show

signals in various formats. This lab project was successful in

demonstrating MATLABs powerful features in a quick and

easy method.

REFERENCES

[1] Haykin, S., “Signals and Systems 2nd Edition” McGraw-Hill, New York, NY, 2007.