DOC PREVIEW
Rose-Hulman ECE 205 - Transfer Functions and an Optical Transmitter and Receiver

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 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 8 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 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ECE-205 Lab 6Transfer Functions and an Optical Transmitter and Receiver1 ECE-205 Lab 6 Transfer Functions and an Optical Transmitter and Receiver Overview In this lab we will first learn how to implement transfer functions in both Matlab and in Simulink. Next we will build an optical transmitter and receiver. The transmitter/receiver is not related to the transfer functions, so don’t hurt yourself trying to figure out how the two parts of the lab are related. However, building the transmitter and receiver will help with your circuit building skill and is pretty cool. You will need to get from me an infrared LED, a photo transistor, a 51 ohm resister, a 10 kilo-ohm resister, and a 1 kilo-ohm resister. PART I: Representing Systems with Transfer Functions in Matlab and Simulink Up until now we have represented our systems in terms of differential equations. In order to represent these systems in terms of transfer functions we only need to remember two simple things about Laplace transforms and transfer functions: 1) For transfer functions, we assume the initial conditions are zero (just as for the impulse response) 2) If { }() ()xt X s=, then if we assume the initial conditions are zero we have ()()dx tsX sdt= and 222()= s ( )d xtXsdt 3) The transfer function of a system is the transform of the output divided by the transform of the input. You should be able to show that the transfer function for our first and second order system representations, 22() () ()() 2 () ()= ()nn nyt yt Kxtyt yt yt K xtτζω ω ω+=++  are 222()()() 1()()() 2nnnYs KHsXs sKYsHsXs s sτωζω ω= =+= =++ Next we need to learn to represent systems using transfer functions in both Matlab and Simulink Let’s first start with the way Matlab represents polynomials. If you wanted to represent the polynomial 2() 3 2 1ps s s+= + in Matlab, you would enter the coefficients into an array p, p=[3 2 1]. The coefficients always go from high to low. The last (rightmost) entry in the array is the coefficient of 01s =, or the constant term. You must also always include a number for every coefficient, even if that coefficient is zero. For example, to enter the polynomial 4() 2 3ps s s= +into Matlab, you would type, p = [2 0 0 3 0]. For the most part, our transfer functions will be the ratio of two polynomials. We need to use the Matlab function tf, to tell Matlab that we want to construct a transfer function made up of two polynomials. For example, to enter the transfer function 213)1(2ssHss+++= into Matlab, we would type2 num = [1 1]; % numerator polynomial of the transfer function den = [3 2 1]; % denominator polynomial of the transfer function H = tf(num,den); % construct the transfer function We would, of course, just combine the three steps into one step, H = tf([ 1 1],[3 2 1]); If you do not put the semicolon at the end, Matlab will write the transfer function to the workspace (so you can check that you entered it correctly). We will next show how to determine the response of a system represented by a transfer function to a step (or arbitrary input) in both Matlab and Matlab/Simulink. We will go through the steps for a first order system, then you will modify these for a second order system. 1) Open a new Matlab m-file (in a convenient folder). We will use one m-file for this lab. At the top of the file type the usual clear variables 2) Set the variables tau = 0.001 and K = 2.0 3) Enter the transfer function 1pGKsτ=+into Matlab. 4) Enter the final time variable Tf = 0.01 (be sure to use at least one capitol letter so it is not confused with the transfer function command tf). 5) Use the linspace command to create a time vector t from 0 to Tf with 1000 sample points. 6) let’s assume we want a step input with an amplitude of 0.1. There are many ways to generate this, but we will use the following command: x=0.1*ones(1,length(t)); 7) To simulate the system, we then use the lsim command as follows: y = lsim(Gp,x,t); 8) You should now pretty up your plot so it looks like the plot in Figure 1. Note that I have really plotted more than one graph in this figure, which you will do shortly.3 Figure 1. Response of first order system to a step of amplitude 0.1 We now want to prepare to use Simulink, and learn (and review) a few more commands as we go. 9) We will be using the times and input values from Matlab, so enter the command xt = [ t’ x’]; into your m-file. 10) Athough we already know the numerator and the denominator of the transfer function, let’s learn to extract them once we have a transfer function. We use the command [num_Gp,den_Gp] = tfdata(Gp,’v’); to extract the numerator and denominator polynomials from the transfer function Gp. 11) Start Simulink from the Matlab window, and open a new model file. Save this model file as openloop.mdl. 12) Construct the model file shown in Figure 2. You will need to look in the Sources Library for the from workspace block and the clock block, the Sink Library for the to workspace blocks (be sure to save the data as an array, click on these boxes for this choice), and the Continuous Library for the transfer function block. Click on the transfer function block to enter the numerator as num_Gp and the denominator as den_Gp. Be sure to change the final time of the simulation to Tf. The final time of the simulation defaults to 10 seconds, and it appears in a box near the top of the Simulink model file. 00.0010.0020.0030.0040.0050.0060.0070.0080.0090.0100.020.040.060.080.10.120.140.160.180.2Time (sec)y(t)Response of First Order System MatlabSimulink4 Figure 2. The openloop Simulink file. 13) Run the simulation from the m-file using the command, sim(‘openloop’); 14) At this point you have results from both Matlab (t,y) and Simulink (ts, ys). Modify your m-file to plot both of these results on the same graph. Use two different line types and colors, use a grid, label the x-axis etc. so your results look like that in Figure 1. You need to include your graph in your memo. 15) Now you need to modify your m-file so you can plot the results for a second order system with a natural frequency of 2000 rad/sec, a damping ratio of 0.2, and a static gain of 1.5. It is probably best to just copy and paste what you already have. If you have done everything correctly, you should get a graph like that shown in Figure 3. You need to include your graph in your memo, but


View Full Document

Rose-Hulman ECE 205 - Transfer Functions and an Optical Transmitter and Receiver

Download Transfer Functions and an Optical Transmitter and Receiver
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 Transfer Functions and an Optical Transmitter and Receiver 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 Transfer Functions and an Optical Transmitter and Receiver 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?