

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


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”.
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