12
Topics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos Simulation speed (included for troubleshooting purposes) Simulation time(included for troubleshooting purposes) Auto scaling the demo(this section is better read from the text above each demo) Running the demo(this section is better read from the text above each demo) Plots Note: Quick run notes are included at the start of all demos, refer to these for specific notes on running the demo and Auto scaling the demos Running your own Matlab code simultaneously or 2 demos at once Note: This text is not as long as it seems, it is a 5-10min read with a lot of pictures to help you through running demos. The user of these demos does not need any prior Matlab experience, thus this text is not aimed at teaching you how to make demos; it is aimed at teaching you how to run them. That being said if you inadvertently change or “break” a demo and are unable to restore it to its original condition I recommend closing it without saving changes and reopening it. If you accidentally saved undesirable changes then deleting the copy you changed and downloading the demo from its origin should solve this issue.

Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Topics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos Simulation speed (included for troubleshooting purposes) Simulation time(included for troubleshooting purposes) Auto scaling the demo(this section is better read from the text above each demo) Running the demo(this section is better read from the text above each demo) Plots Note: Quick run notes are included at the start of all demos, refer to these for specific notes

on running the demo and Auto scaling the demos Running your own Matlab code simultaneously or 2 demos at once

Note: This text is not as long as it seems, it is a 5-10min read with a lot of pictures to help you through running demos.

The user of these demos does not need any prior Matlab experience, thus this text is not aimed at teaching you how to make demos; it is aimed at teaching you how to run them. That being said if you inadvertently change or “break” a demo and are unable to restore it to its original condition I recommend closing it without saving changes and reopening it. If you accidentally saved undesirable changes then deleting the copy you changed and downloading the demo from its origin should solve this issue.

Page 2: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Installing Matlab softwareThese demos have been created in a way that requires basic computer skills and not much else in order to operate, that being said they do require the use of Matlab in order to run. Imperial engineering students can download the software for free from the following link:http://www3.imperial.ac.uk/newsandeventspggrp/imperialcollege/administration/ict/softwareshop/newssummary/news_27-8-2009-14-0-8 You will be using this software at some point during your studies- downloading and installing it will be beneficial to you. Downloading and installing the software can take up to 3hours depending on your computers speed as well as internet connection, a lot of this time is spent downloading the files which is a task easily sent to the background. If for any reason you are unable/ unwilling to install the software, it is available on most cluster computers in the university.

If you have not downloaded the demos already, they can be accessed from ____________ , once they are downloaded. The instructions following this page give a detailed explanation on how to run them.

Note: If the demos do not run this might be because of their name. Please insure the demos maintain adequate names some browsers may add a (1) or a space in the demos name to make it unique this might result in the demos not running. For imperial students, blackboard may add characters such as spaces into the name-these should be edited out of the demo’s names.

Page 3: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Opening MatlabIn order to open Matlab follow the following path “Start>All Programs>Matlab>Matlab R2011a” (this path might be slightly different) once Matlab is open and maximized, the screen should look similar to this but might have a few other menus and side bars:

Next open the Simulink program by clicking on its icon as shown below

Performing the above action opens the Simulink Library Browser window shown in the next demo. In this window click on File (as shown below) and then scroll down and select Open. From here locate the demo you would like to open from the place you saved the demos.

Clicking on this icon will result in Simulink opening, this is where SimMechanics resides. When the cursor hovers over it should display the name Sumulink.

Page 4: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Click on File, then go down to Open and locate the demo you would like to open from the place you saved them.

These are short reminder notes on how to run the demo

Special demo -notes such as axis orientation, assumptions etc.

Scopes- these contain real time plots. In order to open them, double click them.

This is the “Subsystem” box, double click this box in order to change parameters and initial conditions as well as choose to hold plots or not(see below for a description of what hold plots is).

Page 5: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Changing ParametersDouble click on the Subsystem box (the location of which is shown above), this opens a dialogue box(shown below), change the parameters you want to change and then click on OK or press Enter on the keyboard to apply the changes.

Notes on the physics behind the demosIf you are having difficulty locating/opening the subsystem box instructions and a picture on where this is, can be found on the section on changing parameters.

Notes on the physics behind some of the demos is give in the Subsystem box of some of the demos; those in which an extra explanation would be helpful. In order to access these, double click the subsystem as though you intend to change a parameter, at the top of this box on some demos (such as the projectiles and escape velocity demos) the basic physics behind the demos is shown.

Notes on the physics behind the demo

Changeable parameters

Page 6: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Simulation speedSettings which change the speed at which simulations run can be found on the models window under Simulation>Configuration Parameters, please see the diagram below:

Once you click on Configuration Parameters a window should pop up, in this window go to Solver and edit the Max step size option as shown below.

Page 7: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

The time the demo runs

This page may be skipped; it is added as a troubleshooting page.

If a demo stops before it is supposed to, try increasing the maximum simulation time for the demo. This can be changed at the location shown below by simply clicking and entering a new maximum time:

Note: most demos have conditions which automatically cause the demos to stop for example the demos with ramps stop as soon as the object on the ramp is about to leave the ramp regardless of the maximum simulation time.

Change the maximum amount of time the demo runs for here.

Page 8: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Scaling the demo

This section is included in the demos and is better read and executed using the notes in each demo, please see above (Running the demo for notes on where these are located).

We have placed markers which make the demos fit to screen in a manner we think is adequate, though you may want to manually make the demos fit to screen, the demos are in no way locked so you may do so however the instructions to do so will not be included in this “how to” document, though they may be found by accessing the help button in the “Machine for Model” page as shown below:HINT: This page automatically opens once you play the demo or after pressing Ctrl+D

In order to use the markers we have set to make the demos automatically fit to screen, once you have finished changing parameters, we recommend Pressing Ctrl+D and then selecting the view you would like in the options pane for example, for a side-on view

This button will show you how to change visualisation settings.

Select this option, in most demos it is the best option.

Notice the orientation of the system.

Page 9: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Note some demos do not need to be scaled, please have a quick look at the start of the demo at the quick run notes before scaling the demos.

After selecting the above option this is the view that is acquired. Notice the difference.

Page 10: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Running the demo

This section is included in the demos and is better read and executed using the notes in each demo.

Notes on running the demo

Page 11: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Plots

There are many things we could have chosen to plot, but in order to keep the demos as simple as possible and user friendly, we limited these to a few that are of interest.What is holding a plot? Each time a demo is run a plot is produced, in order to compare these plots it is useful to view them on the same graph. This can be done by “holding the plots”, the option for holding plots or not is given as a tick box in the “Subsystem” box as illustrated. Once selected, it will store previous plots. The limit of this function is a maximum of 6 plots from the first demo you run in some demos and 3 from the first you run in others. The actual number it holds depends on when the hold function is enabled. *The limitation in the demos plot functions is of no fault of Matlab or Simulink, we simply wanted to keep our code short as well as use unique colours in each plot-Matlab and Simulink has an infinite range of colours (or shades of colours) but there are only 6 broadly distinct colours.

Page 12: Shefelbine · Web viewTopics covered in this tutorial Installing Matlab and Simulink downloading the demos Opening Matlab Changing Parameters and notes on the physics behind the demos

Running Matlab code simultaneously-advanced users onlyThese demos do run some code in Matlab though we have named variables it uses in a very distinct way for example brickandcardemoindex, so running demos in parallel should not be a problem or writing code in Matlab while running demos should also not present any problems. If any errors occur or you are unsure, the safe bet is to open 2 Matlab windows or run one demo at a time. We also design the demos with as little intrusion as possible; we do not change the view settings of your Matlab window or clear all variables in our code. The only thing we do however is close the figure palette in the plotting window this is to allow for beginners to get good space for plots and not have stacks of irrelevant information. This can re-opened by entering the command figurepalette in the Matlab command window.