DOC PREVIEW
Rose-Hulman ECE 205 - ECE 205 Lab 1

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ECE-205 Lab 1 Introduction to Simulink and Matlab Throughout this lab we will focus on determining the behavior of a first order system written in the standard form ((())ydy tdtttKxτ=+ ) where()xtis the input, is the output, ()ytτ is the time constant, and K is the static gain. We will first introduce Simulink for modeling this system, then show how we can use Matlab to run the Simulink file, and finally how we can use Matlab to produce some nice plots and do some other cool stuff. For the most part, just following along and type what you are told to type. You will only learn by doing (and seeing examples). The following examples will be specific to Matlab 2008a, but you can use them with only minor modifications for other versions of Matlab. The only thing you need to turn in is at the end of the lab, but you will need to work through the rest of the lab to get there. PART I 1) In order to make our simulation diagram, we need to solve for the highest derivative power, () () ()yt Kxt ytτ=− or []1() () ()yt Kxt ytτ=− Clearly if we integrate we will get . So our simulation diagram will require some scaling (or gain blocks), a summing block, and an integration block. ()yt()yt 2) Next you need to create a folder for Matlab to store the files you will be generating in. Although Matlab has a default folder, it is much better practice to have individual folders for each class (or lab, etc). So create a folder for Matlab. 3) Start Matlab. When it is done initializing (it says Ready near the Start button), change the Matlab folder to the folder you set up in step 2. 4) Since we are going to use Simulink first, type simulink in the command window (and hit enter). A window will pop up that looks something like the following: 1 This window gives us access to the available blocks in Simulink (if you can find them), and lets us get started. 5) In this new window, click on File, select New, then select Model. Yet another window will open up for you, and this is where you will build your Simulink model. In order to save your work, in this new window click on File, then Save As, then you need to give it a name with the suffix mdl. Let’s assume you name your model file test.mdl. Before we go on, let’s set some parameters. Let’s assume 0.02τ=seconds, , and the input is a step with amplitude . Now we will build our model. 0.5K =0.5A = 6) In the Simulink Library Browser, scroll down until you see a block named Sources as shown in the figure on the next page, and then double click on it. This is where we will find our available system inputs. 7) Drag Clock over to your Simulink model file, test.mdl, and then scroll down to find Step and drag this over to your model file. 2 Sources (inputs) are here 8) Next we are going to need a Sink, or a way to save or plot our results. In the left panel, click on Sinks and then drag XY graph over to test.mdl. Be sure to save test.mdl regularly so you do not lose your work. 9) We are going to need an integrator, so click on Commonly Used Blocks in the left panel, and drag an Integrator (1/s) over to your model file, drag a Sum over to your model file, and then drag a Gain over to your model file. At this point, you have a pretty random set of blocks in your test.mdl file, and we need to start connecting them. Most often people think of their simulations going from left to right, so that is how we will set ours up. Be sure to save test.mdl now, and regularly! 10) Rearrange the blocks in the general order you will use them, as shown in the following figure. At this point you probably realize you will need another Gain block. You can go back to the Library Browser, or just right click on the Gain block you have and choose copy and then paste. 3 11) Now we are ready to connect our blocks. This takes some practice, but you generally click on the source or destination block (you will figure out what works for you). Connect the blocks so your file looks like the next figure. To get the bottom line into the summer, you may want to make a line going down from the sum block, let go, then make a separate line from your first line to the line after the integrator. Next we need to clean some things up and start entering our parameters. 4 12) Double click on the Step block, and set the Step Time to 0 and the Final Value ( the amplitude of the step) to 0.5 (the value of A). Then click OK. 13) Double click on the Gain block next to the Step block, and set the gain equal to 0.5 (the value of K), and then click OK. 14) Double Click on the Sum block. We will change the parameters, as shown in the figure below. Let’s choose a rectangular sum block (this works better if there are more inputs), and change the bottom sign to -, which is what we want. Also, we will put in extra space by adding some space, denoted by |. After you click OK you will see the change in the Sum block in your model file. The changes are shown on the next page. 15) The next Gain block represents 1/τ, so double click on it and enter 50, then click OK. 16) We want to be able to see our output, so double click on the XY Graph and enter x-min = 0, x-max = 0.3, y-min = 0, y-max = 0.3, then click OK. 17) If we are only going to plot our output from 0 to 0.3 seconds, there is no reason to run the simulation any longer than this. Change the final time of the simulation to 0.3, and then run the simulation by pressing the play button, as shown on the next figure. 5 Play button, to run the simulation Final simulation time If you have done everything correctly, you should get a graph like the following: 6 PART II While the XY Graph is nice for getting a basic idea of what is going on, you have little control over how the graph is presented. You also need to know a lot about the signal you want plotted. Matlab, however, has some very nice graphing capabilities, so we would like to be able to use them. What we need is a way to access the data we have generated. 1) Go back to the Simulink Library Browser, click on Sinks, and then drag two simout (To Workspace) blocks over to your simulating file (test.mdl). 2) Right click on XY graph to delete it.You can click on data paths to delete them also. 3) Connect the simulation output (y) and the …


View Full Document

Rose-Hulman ECE 205 - ECE 205 Lab 1

Download ECE 205 Lab 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view ECE 205 Lab 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ECE 205 Lab 1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?