# 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^{[1]}.

## Contents

### Desktop basics[edit]

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

- If you ever accidentally change your desktop layout, select
*Home>>Layout>>Default* - Each window can be maximized using the triangular icon near each window's title. Once maximized, it can be restored to
*Default*using the square/rectangles icon situated next to the triangular icon. - If you can't find the
*Editor*window verify that you have opened something for editing! - Use the up down arrows ( ↑ and ↓ ) to recall previous commands that you have typed.

### Matrices and arrays[edit]

**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[edit]

**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[edit]

**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[edit]

- 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[edit]

**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[edit]

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

- See
**MATLAB/Cookbook/symbolicIntegration**for plotting functions defined symbolically.

### Programming and scripts[edit]

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

### Help and documentation[edit]

**Help and Documentation** If you know the name of your function, type **help functionname** for quick help and

**help**for a link to pages explaining the function.

*functionname*## Links and footnotes[edit]

- ↑ Open MATLAB and look for the statement:
*New to MATLAB? Watch this*.**Video**, see**Examples**, or read**Getting Started**

If you do not see this line, use**Help>>Matlab>>Getting Started**