1 / 35

MATLAB Tutorials

MATLAB Tutorials. Session VII Introduction to SIMULINK. Rajeev Madazhy Email: rmadaz1@lsu.edu Dept of Mechanical Engineering LSU. Last Session…. Engineering Applications using MATLAB…. Solving non linear differential equations Algorithm analysis for four bar linkage problem

kreeli
Download Presentation

MATLAB Tutorials

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MATLAB Tutorials Session VII Introduction to SIMULINK Rajeev Madazhy Email: rmadaz1@lsu.edu Dept of Mechanical Engineering LSU

  2. Last Session…. • Engineering Applications using MATLAB…. • Solving non linear differential equations • Algorithm analysis for four bar linkage problem • Other mechanical problems

  3. Session VII Outline…. • Introduction to Simulink • Solving simple problems using Simulink

  4. Simulink….. • Simulink is a program that runs as a companion to MATLAB • Simulink provides a graphical user interface (GUI) that is used in building block diagrams, performing simulations, as well as analyzing results of dynamic systems. • In Simulink, models are hierarchical so that you can view a system at a high level, then double click on blocks by using the mouse to go down through the design levels.

  5. Getting started….. Lets get started with a simple example of simulating a sin wave. To open Simulink open the MATLAB command window first. Click on the icon which is present in the toolbar in the command window of MATLAB. Alternatively you can also enter the command Simulink to open the graphics library of simulink

  6. Opening Simulink….

  7. Simulink block library….

  8. General list of libraries…. Source type blocks produce input signals.The Sine Wave block is a source type block Sink type blocks provide a place for output. The scope block is a sink type block. Linear type blocks perform a linear transformation. The Integrator is a linear type block. Connection type blocks are involved with formingvector signals, the Mux block is an example.

  9. Adding a block from the library….. To open a block library, double click on the associated library icon in the Simulink block library window. After opening the Sources library, the Sources library window opens, as shown

  10. Simulink Library Browser….

  11. Adding a block from the library….. • To add the first block to the diagram, point the mouse at the Sine Wave block in the Sources library window and press the left button. • Create a new model window by clicking on to the new icon at the toolbar. • Without releasing the left mouse button, drag the mouse to the new model window and release the mouse button.

  12. Simulink model window….

  13. Pulling the selected blocks…. Pull in the following blocks for our simulation from the following libraries. Block From Library Sine wave sources integrator Linear Mux connections Scope sinks

  14. Inputs and outputs…. In general the inputs to a block are on the left a > symbol points into the block. In addition, outputs are generally on to the right, a > symbol out of the block. To add a connection, use the mouse to position the pointer over the output port of the block. During this time the pointer changes to cross hairs .

  15. Cont… The completed connection should look like this…. Adding a branch line….This is required when you have an output which needs to be connected to two separate blocks

  16. Cont… To complete the connections, add a line from the output of the integrator block to the input port of the mux block. When you are done it should look similar to the following. Labels can be added to lines to further annotate your model. To create a signal label, double click on a line segment and type the label at the insertion point.

  17. Final model…. Save the model as example1.mdl

  18. Giving model parameters….. The sine wave block Double click on the sine wave block and examine the data fields. Sine wave block parameters: Amplitude = 1 Frequency (rad/sec) = 0.25*2*pi Phase(rad) = 0 Sample time = 0

  19. Block Parameters of Sine Wave….

  20. Integrator Block…. Integrator block parameters: External reset = None Initial Conditions = 0 Limit Output = Not checked Show saturation point = Not checked Show state port = Not checked Absolute tolerance = auto

  21. Block parameters: Integrator

  22. Simulation parameters…. Go to simulation => parameters in the model window toolbar Enter the following values

  23. Run the simulation…. To view the results of the simulation, double click on the scope block.

  24. Cont…. To better fit the display in the scope window, click on the ‘Fit View’ button . The scope window should similar to the following.

  25. Example 2…. The next example would be to simulate the dynamics of second order system. Given that: Obtain the velocity and displacement response

  26. Building the model…. The same procedure is applied as being shown in the first example. Pull all the necessary blocks from the library browser. The blocks required is as follows: BlocksNumber Integrator 2 Sum 1 Scope 3 Step I/P 1 Gain 3

  27. Final Model….

  28. Gain parameters- 1st Gain block Similarly give the gains for the second and the third one as shown in the model window.

  29. Block parameters - Step

  30. Simulation parameters….

  31. Output from Scope1 and Scope2…

  32. Output from Scope3…. Scope3 shows the displacement response for the second order system.

  33. References…. MATLAB website (http://www.mathworks.com) has a comprehensive list of examples and references to SIMULINK. There are several books which cater to this area. One of the good references is listed below: Mastering Simulink 4James B. Dabney & Thomas L. Harman ISBN 0-13-017085-2

  34. Looking back…. This completes the MATLAB Tutorial. Sessions 1 to 7 covered almost all areas of applications of MATLAB. Specialized areas of MATLAB are using the toolboxes. These are a collection of m-files that are specific to the area of application.

  35. Thank You

More Related