ELEC 320: Laboratory Assignment 1

Introduction to MATLAB

 

Throughout this semester, you will be working with linear systems and signals. As systems get complex, a “paper-and-pen” analysis gets difficult and becomes time consuming. The use of computer tools to help solve and visualize the response of systems will greatly expedite your analysis and your understanding of the system. In this course, we will encourage you to learn and use a software package called MATLAB.

 

MATLAB (MATrix LABoratory) is a popular software package used in the analysis of signals and systems. Keep in mind that this course is about linear systems and signal processing; it is NOT about MATLAB. We simply use MATLAB as way to help us with our analysis.

 

Part 1: MATLAB Tutorial

 

In this laboratory session, we will first get familiar with the MATLAB interface and learn the following:

 

You may take a look at the following link for a brief tutorial on these topics.

 

Part 2: Using MATLAB to analyze an Op-amp circuit

 

1.       Sketch an inverting operational amplifier circuit with a gain of -10 V/V. Derive the equation for the output voltage, (Vout).

2.       Consider the input voltage (Vin) to be a DC voltage. Using MATLAB, compute the output voltage (Vout) when the input voltage is at 0V, 1V, 2V, 3V, 4V and 5V.

3.       Create a plot of Vout vs. Vin. What is the slope of the plot? Is it what you expected?

4.       Now consider the input voltage to be an AC voltage source.

a.    Create a sinusoidal signal with an amplitude of 2 V and frequency of 1000 Hz. Plot at least ten periods as shown below.

a.    Compute and plot the output voltage when this input signal is applied to the input of the op-amp. Assume that your op-amp saturates at ±15V.

 

Part 3: Using MATLAB to analyze a simple RC circuit

 

5.       Let v(t)=4/∏(sin (wt) +1/3 sin(3wt)+1/5 sin (5wt)+…) be an approximation of a square wave signal. Let w=2∏* 1000 rad/sec.

a.    Plot the first two terms in the approximation.

b.    Plot the first three terms in the approximation.

c.    Plot the first ten terms in the approximation.

 

6.       Using a FOR loop (refer back to Part1 or to the tutorial link or type “help for” ) plot the first 40 terms in the approximation.

 

7.       Assume v(t) is the input to a series RC circuit with bandwidth of 1500 HZ. Derive and plot the output voltage across the capacitor.

 

 

 

EXCELLENT LINKS TO OTHER MATLAB TUTORIALS

MATLAB Tutorial from MathWorks
This is an excellent tutorial from the creators of MATLAB. You might need to create a username and password before you startthe tutorial. Go through the first 30min of the tutorial. If you have time do the whole 90 mins. You will learn a lot about MATLAB from this tutorial.

 

Prof Maneval's tutorials
This is another really good learning site for MATLAB. If you find yourself asking "How do I do [insert_particular_thing] in MATLAB"? this site will help you answer most of the questions. This tutorial also includes a number of excerises.

 

PDF Tutorials from Southern Illinois University at Carbondale
This tutorial consists of 6 pdf files. Each tutorial also includes MATLAB m-files that are included in the text of the PDF.

 

MATLAB function reference from Mathworks