getting started 2d-plots matrix & linear equations

10
Getting started 2D-Plots Matrix & Linear Equations Lecture 4. Matlab Basics 1

Upload: levi-campbell

Post on 31-Dec-2015

19 views

Category:

Documents


2 download

DESCRIPTION

Lecture 4. Matlab Basics. Getting started 2D-Plots Matrix & Linear Equations. Getting Started. Matlab program can be found at: apps.asu.edu. Getting Started. Tutorials and demos can be found at http://www.mathworks.com/products/matlab/demos.html?show=demo. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Getting started 2D-Plots Matrix & Linear Equations

Getting started

2D-Plots

Matrix & Linear Equations

Lecture 4. Matlab Basics

1

Page 2: Getting started 2D-Plots Matrix & Linear Equations

2

Getting Started

• Matlab program can be found at: apps.asu.edu.

Page 3: Getting started 2D-Plots Matrix & Linear Equations

3

Getting Started

• Tutorials and demos can be found at http://www.mathworks.com/products/matlab/demos.html?show=demo

• Getting Started with MATLAB (4 min 58 sec) 

• Working in The Development Environment (4 min 13 sec) 

• Writing a MATLAB Program (5 min 36 sec) 

Page 4: Getting started 2D-Plots Matrix & Linear Equations

4

2D Plots

• Tutorials and demos for 2D plots can be found at

http://www.mathworks.com/products/matlab/demos.html?file=/products/demos/shipping/matlab/graf2d.html

Page 5: Getting started 2D-Plots Matrix & Linear Equations

5

Matrix and Linear Equations

• Linear Equations (n-variables and m-equations)

11212111 ... bxaxaxa nn

22222121 ... bxaxaxa nn

mnmnmm bxaxaxa ...2211

…..

• Matrix representation

Ax=b

Page 6: Getting started 2D-Plots Matrix & Linear Equations

6

Matrix and Linear Equations

• Matlab representation

Ax=b• Matrix representation:

mnmm

n

n

aaa

aaa

aaa

A

...

......

...

...

21

22221

11211

nx

x

x

x.1

1

mb

b

b

b.1

1

• Solution: x=A-1b

x=b/A

Page 7: Getting started 2D-Plots Matrix & Linear Equations

7

Matrix and Linear Equations

• An example

032 321 iii

• Solve the problem with Matlab

>> A=[-2 1 3;1 1 0; 0 3 -1]

5.121 ii03 32 ii

130

011

312

A

0

5.1

0

b

>> b=[0;1.5;0]

>> i=b/A

Step 1

Step 2

Step 3

Page 8: Getting started 2D-Plots Matrix & Linear Equations

8

Matrix and Linear Equations

• What if

032 321 iii

• Solve the problem with Matlab

>> A=[-2 1 3;1 1 0; 0 3 -1]

siii 5.121 03 32 ii

130

011

312

A

0

5.1

0

sib

>> b=[0;1.5;0]

>> i=b/A

Step 1

Step 2

Step 3

Step 3 Multiply the results by is

Page 9: Getting started 2D-Plots Matrix & Linear Equations

9

Matrix and Linear Equations

• What if

sviii 232 321

• Using the superposition principle!

siii 5.121 03 32 ii

130

011

312

A

ss vib

0

0

2

0

5.1

0

the same

BUT

Page 10: Getting started 2D-Plots Matrix & Linear Equations

10

Matrix and Linear Equations

• Re-write the equation as

ss v

i

i

i

i

i

i

i

x

''

3

''2

''1

'3

'2

'1

Solve one at a time and add the results according to

0

5.1

0

130

011

312

'3

'2

'1

i

i

i

0

0

2

130

011

312

''3

''2

''1

i

i

i

and