Intro to Matlab

Submitted by: Submitted by

Views: 211

Words: 18772

Pages: 76

Category: Business and Industry

Date Submitted: 03/14/2013 10:30 AM

Report This Essay

An Introduction to Matlab

Version 3.0

David F. Griffiths

formerly of

Department of Mathematics

The University of Dundee

Dundee DD1 4HN

Scotland, UK

With additional material by Ulf Carlsson

Department of Vehicle Engineering

KTH, Stockholm, Sweden

Thanks to Dr Anil Bharath, Imperial College,

for his contributions to this revised version.

c

Copyright ￿1996 by David F. Griffiths. Amended October, 1997, August 2001, September 2005,

October 2012.

This introduction may be distributed provided that it is not be altered in any way and that its

source is properly and completely specified.

Contents

1 MATLAB

2

2 Starting Up

2

3 Matlab as a Calculator

3

4 Numbers & Formats

3

5 Variables

5.1 Variable Names . . . . . . . . . .

3

3

6 Suppressing output

15 Two–Dimensional Arrays

15.1 Size of a matrix . . . . . . . .

15.2 Transpose of a matrix . . . .

15.3 Special Matrices . . . . . . .

15.4 The Identity Matrix . . . . .

15.5 Diagonal Matrices . . . . . .

15.6 Building Matrices . . . . . . .

15.7 Tabulating Functions . . . . .

15.8 Extracting Parts of Matrices

15.9 Elementwise Products (.*) .

15.10Matrix–vector products . . .

15.11Matrix–Matrix Products . . .

15.12Sparse Matrices . . . . . . . .

4

7 Built–In Functions

7.1 Trigonometric Functions . . . . .

7.2 Other Elementary Functions . . .

8 Vectors

8.1 The Colon Notation . . . .

8.2 Extracting Parts of Vectors

8.3 Column Vectors . . . . . . .

8.4 Transposing . . . . . . . . .

.

.

.

.

.

.

.

.

.

.

.

.

9 Keeping a record

10 Script Files

11 Keyboard Accelerators

12 Arithmetic with Vectors

12.1 Inner Product (*) . . . . .

12.2 Elementwise Product (.*)

12.3 Elementwise Division (./)

12.4 Elementwise Powers (.^) .

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

13 Plotting Functions

13.1 Plotting—Titles & Labels

13.2 Grids . . . . . . . . . . . .

13.3 Line Styles & Colours . .

13.4 Multi–plots . . . . . . . .

13.5...