Docsity

MATLAB QUICK GUIDE, Schemes and Mind Maps of History

Toggle sidebar
bg1
Calculations can be done either in the ”Command window” or the ”Editor”. The command
window is a temporary place to see your commands, the commands themselves are saved in the
”Command history”, but not the answers. The solution to the calculation is displayed in the
”Command Window” and stored in the ”Workspace”. If you do not assign a variable name to the
calculation, the answer is stored in the default variable name ”ans” .
2
MATLAB QUICK GUIDE
When you open MATLAB you will see the following (note that the windows within MATLAB may
be arranged slightly di↵erently)
pf3

Partial preview of the text

Download MATLAB QUICK GUIDE and more Schemes and Mind Maps History in PDF only on Docsity!

Calculations can be done either in the ”Command window” or the ”Editor”. The command window is a temporary place to see your commands, the commands themselves are saved in the ”Command history”, but not the answers. The solution to the calculation is displayed in the ”Command Window” and stored in the ”Workspace”. If you do not assign a variable name to the calculation, the answer is stored in the default variable name ”ans”.

MATLAB QUICK GUIDE

When you open MATLAB you will see the following (note that the windows within MATLAB may be arranged slightly di↵erently)

For example, if we want to add 3 + 5, we can type: 3 + 5 in the Command Window.

Now we can assign a variable to the answer:

Note that at this point, the answer is a variable of size (m,n) where m is the number of rows, and n is the number of columns. For this example, A is a 1x1 array.

Often, you will be adding vectors - your variable would then be a 1x2 vector array (for 2-D problems) or a 1x3 array (for 3-D problems).

General guidelines

  • Create your vectors as variables (e.g. A = [1 2 3]; B = [3 4 5])
  • Perform secondary calculations using these variables and save this as another variable (e.g. C = A + B)
  • DO NOT round intermediate calculations
  • Give your variables meaningful names (e.g. force1, F1, moment1, fAB for a force going from A to B)