Published online by Cambridge University Press: 08 February 2010
First steps with MATLAB
If you haven't already done so, you should start MATLAB by doubleclicking the relevant icon with your mouse or by asking a friend sitting next to you to show you how. Asking a friend is often the quickest way to obtain help and, in what follows, we will encourage you to take this route when all else fails. If ‘clicking’ and ‘icons’ mean nothing to you, you may need some extra help in getting started with Windows. It might also be that your system doesn't use Microsoft Windows and that simply typing matlab will do the trick. For example, if you are using a Unix system of some kind this may be the case. If all goes well you will see a MATLAB prompt
>>
inviting you to initiate a calculation. In what follows, any line beginning with >> indicates typed input to MATLAB. You are expected to type what follows but not the >> prompt itself. MATLAB supplies that automatically.
Arithmetic with MATLAB
MATLAB understands the basic arithmetic operations: add is +, subtract is −, multiply is * and divide is /. Powers are indicated with ^, thus typing
results in
If you typed the above line and nothing happened, perhaps you omitted to press the <Enter> key at the end of the line. The laws of precedence are built in but, if in doubt, you should put in the brackets. For example
The sort of elementary functions familiar on hand calculators are also available.
To save this book to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.