## Engineering and Design Tools - Modelling With Matlab - Simulink

1. Introduction
Matlab is a mathematics package which has particularly strong capabilities at manipulating matrices. A useful introductory guide is ref. MS1. The part that we are interested in is the Simulink simulation part of the package. This is intended for analysing the performance of control systems and the behaviour of dynamic systems.

Once Matlab is started from the icon, Simulink is started by typing simulink [rtn] in the command window.

2. Practical Details
Systems are modeled by dragging and dropping appropriate elements into a modeling window. A range of elements are available from libraries including:

• 'continuous' elements - derivative, integrator, transfer function
• functions and tables - look up table, polynomial
• math - algebraic constraint, gain, sum, math function
• non linear - backlash, switch
• signals and systems - function call generator
• sinks - to workspace, to file, scopes (to view signals)
• sources - clock, signal and pulse generators, ramp and sine wave signals, from file
• subsystems

Once elements are dropped into the modelling window they are connected output to input - this is done by placing the cursor over the output port of one element, pressing the left mouse button and moving the cursor to the inlet port on the appropriate element and releasing the mouse button. A link will appear with an arrow indicating the direction of signal flow.

Element parameter values are set by right clicking with the cursor over it then clicking on Block parameter and entering the appropriate value in the parameter form that is shown and then clicking OK.
For example if a torque is to be applied as an input to a rotary system and the value of the angular acceleration is the required output, then a gain element is required and the parameter needed - the gain constant - is equal to the inverse of the equivalent moment of inertia. If the angular velocity is required then the angular acceleration is fed as the input to an integrating element which provides velocity as the output.

To connect a link into an existing link (e.g. to provide a feedback link) place the cursor over the position on the link where you want the branch to start then press [cntrl] and the left hand mouse button and take the link to the required input port or summing point and release the mouse button.

For anything other than a simple model it is a good idea to include a number of oscilloscopes at different places in the model so that any unexpected results can be investigated.

Check the Start and Stop times are appropriate by clicking on the Simulation tab and clicking on the Simulation parameters sub - menu. The time step settings should be left set to auto initially.

The simulation is run by picking the Start command from the Simulation menu.

To view results click on the auto-scale icon (the binoculars) on all the oscilloscope windows.

Think - do the results look believable? Carry out some sort of check if at all possible.

3. References
MS1. 'An Introduction to Matlab', by D M Etter and D C Kuncicky, Prentice Hall, 1999.

David J Grieve. Modified: 14th March 2011, original: 16th July 2002.