MATLAB/Getting started

This resource "shadows" an excellent introduction by the people who maintain Matlab.

You can access appropriate chapters of this introduction by clicking the link that begins each section. (These tutorials are also available from your main MatLab GUI window.

Desktop basics

Desktop Basics shows you the default layout before you open an m-file. (The codes you write are called m-files). It also give very basic information on how to use MATLAB as a calculator, e.g., 2+3=5.

Matrices and arrays

Matrices and Arrays shows you how to create arrays, (including arrays of zeros). Important array operations to know about are concatenation (i.e. adding rows or columns), transpose, inverse, and element-wise operations.

• Element-wise operations are preceded by a dot .(e.g. [1 3].*[2,4]=[1*2,3*4]=[2,12]}, while omission of the 'dot' ([1 3]*[2,4]) returns an error.

Array indexing

Array indexing Helps you sort out the rows and columns of arrays. It introduces just two of many uses of the colon

• 1:2:9 creates [1,3,5,7,9].

Workspace variables

Workspace Variables introduces you to the Workspace Variables window in the lower left corner of your GUI.

• You can also get this information by typing whos.
• Save and restore your workspace variables with save filename.mat and load filename.mat

Character string

• teaches you about 'Hello world', as well as ['Hello',' ','world']
• use the functions num2string and int2string to convert numbers and integers into strings.

Calling functions

Calling Functions introduces you to functions using max, dis, and clc as examples.

• Note the flexibility: clc takes no arguments while max can take one or more arguments and can return either a single value or a double value (in the form of a 1x2 array, e.g., [a,b] = max([4 6 1])

2D and 3D plots

2D and 3D Plots will tell you most of what you need to know about plotting.

Programming and scripts

Programming and Scripts will get you started in running m-files. There are two types: functions and scripts.

Help and documentation

Help and Documentation If you know the name of your function, type help functionname for quick help and help functionname for a link to pages explaining the function.