You are on page 1of 4

Andrew Rynn, 2001 Last Updated: 7 June 2002 MEEN 364 Simulink Handout To Create Simulink Model -Launch

MATLAB 6 -Select working directory -type cd <path> (i.e. cd c:\temp\ -Launch Simulink -type simulink in MATLAB command window -or-click on simulink icon on toolbar (icon to the left of question mark) -Create new model -Click on new model icon (blank page) -or-Select file => new => model from toolbar -or-Ctrl N Location of Necessary Blocks -Continous -integrator -Math -gain -sum -Nonlinear -switch -Sinks -scope -to workspace -Sources -constant -step -sine wave -clock To Create MATLAB m-file -Launch MATLAB 6 -Create new m-file -Click on new m-file icon (blank page) -or-Select file => new => m-file from toolbar -or-Ctrl N Lab Procedure -Create a Simulink model of the mass, spring, damper system. -Use the following values: -mass 4 kg -damping coefficient 2 Ns/m -spring constant 36 N/m -Use the following initial conditions -x(0) = 0.5 m -v(0) = 0 -To assign the initial conditions, double click on the appropriate integrator and enter the initial condition in the initial condition box. 7 June 2002

Andrew Rynn, 2001 Last Updated: 7 June 2002 -To change the simulation time: -select simulation => parameters -or- Ctrl E -modify values for start time and stop time (0 to 40 seconds works well) -Find the following system responses -free response (constant input of 0 or no input) -constant forced response (use constant of 100 N) -step forced response (use step value of 100 N [initial value of 0, final value of 100] and step time of 20 seconds). -sinusoidal forced response (use amplitude of 100 N, frequency of 3) (connect appropriate source to sum block) -Send the results of each simulation to the workspace using a to workspace block -Assign the variable to which the time and response for each simulation will be sent -double click on to workspace block -type variable name in appropriate box -select array for save format -Plot the four responses on one page using the provided m-file: -Create a Simulink model for the car towing problem. -Use the following values: -mass of car 1 1500 kg -mass of car 2 2000 kgm -disturbance force (this force acts equally on both cars) 100 sin t N -drag force (use Fdrag=cv2, c1=0.4, c2=0.3 -force due to motor 500 N -K rope 1000 N/m -length of rope 3 m -Use the following initial conditions -x1(0) = 2 m -x2(0) = 0 Assignment -Duplication of mass, spring, damper handout -Simulink model -MATLAB m-file -Correctly labeled response plot -Car towing problem -Simulink model with drag force -MATLAB m-file (if used) -Correctly labeled response plot for simulations with and without drag force including -position of car 1 vs. time -position of car 2 vs. time -tensile force in rope vs. time -distance between two cars (back of front car to front of back car) vs. time -A technical memo written in groups that discusses both simulations. -Refer to guidelines provided in syllabus.

Andrew Rynn, 2001 Last Updated: 7 June 2002

Figure 1 - Simulink Model for Mass, Spring, Damper System Figure 1 is the Simulink model used to simulate the response for the mass, spring, damper system. Figure 2 is a plot showing the response of the system to various inputs.

Figure 2 - Reponses of Mass Spring Damper System to Various Input Forces

Andrew Rynn, 2001 Last Updated: 7 June 2002 The following code was used to generate the results plot. % % % % % % % This m-file will plot the outputs from the simulations of the mass, spring, damper system. Remember to change the variable names for the "to Workspace" blocks in the Simulink model. Put the m-file in the same directory as your Simulink model.

subplot(2,2,1) plot(tf,free) Title('Free Response') xlabel('time (sec)') ylabel('position (m)') subplot(2,2,2) plot(tc,constant) Title('Constant Forced Response') xlabel('time (sec)') ylabel('position (m)') subplot(2,2,3) plot(ts,step) Title('Step Forced Response') xlabel('time (sec)') ylabel('position (m)') subplot(2,2,4) plot(tsi,sine) Title('Sinusoidal Forced Response') xlabel('time (sec)') ylabel('position (m)')

You might also like