General info and matlab

2 MATLAB in ten minutes

0. Why?

MATLAB is a trademark name for a software package, and an acronym for Matrix Laboratory. It is widely used as a tool for linear algebra in engineering, control theory and other applications. Recent versions have the capability to carry out many routines on large matrices relatively efficiently.

1. Find a computer

MATLAB is available in all student PC labs on campus via Apps Everywhere. To get MATLAB on an individual PC such as a laptop, go to the ISS helpdesk in the learning zone. Current laptops have the capacity to host MATLAB, although the wireless connections impose limitations on the speed of operations.

2. Connect to MATLAB

Click on the MATLAB icon, and one or more windows will open. The one you mainly require is the command window, which has a prompt, at which you should type all commands,

≫

3. Type in some matrices

MATLAB uses [ to start a matrix, ] to finish a matrix, comma , to separate the entries of a matrix, and semi colon ; to finish a row in a matrix.

(i) So when you type in

A=[1,2,3;4,5,6] ≫

out comes

A=[(123456)].

(ii) Now type in

B=[1,2;3,4;5,6] ≫

out comes

B=[(123456)],

then to get the transpose, type

B′ ≫

and out comes

[(135246)].

(iii) To obtain a 3×3 identity matrix, introduce

e⁢y⁢e⁢(3) ≫

and out comes

[(100010001)]

4. Do some arithmetic

i) To add B′ and A, just type

B′+A ≫

ii) To multiply the entries of B by 2, type

2*B ≫

iii) To multiply A on the right by B, type

D=A*B ≫

and out comes

D=[(22284964)]

iv) Now multiply B on the right by A by making

E=B*A ≫

and add the identity to make

F=e⁢y⁢e⁢(3)+E ≫

5. Try out some commands

i) To find the row reduced echelon form of E, type

r⁢r⁢e⁢f⁢(E) ≫

ii) To find the eigenvalues of E, type

e⁢i⁢g⁢(E) ≫

and you get a list of the approximate numerical eigenvalues.

iii) To find the inverse of F, type

i⁢n⁢v⁢(F) ≫

and the inverse matrix appears with approximate numererical entries.

iv) To get the exact inverse in terms of rational fractions, type

f⁢o⁢r⁢m⁢a⁢t r⁢a⁢t ≫

then

i⁢n⁢v⁢(F) ≫

v) The determinant is given by

d⁢e⁢t⁢(F) ≫

vi) The characteristic polynomial of F is det⁡(s⁢I-F), and the coefficients aregiven by

p⁢o⁢l⁢y⁢(F) ≫

6. Do some algebra

i) To introduce an algebraic variable, type

s⁢y⁢m⁢s s ≫

ii) then try

G=s*e⁢y⁢e⁢(3)-F ≫

to build a marix with polynomial entries.

iii) Then the inverse is

i⁢n⁢v⁢(G) ≫

7. Complex numbers

i) Type

x=2+3*i ≫

find the real and imaginary parts

r⁢e⁢a⁢l⁢(x) ≫
i⁢m⁢a⁢g⁢(x) ≫

ii) Find the modulus and argument via

a⁢b⁢s⁢(x) ≫
a⁢n⁢g⁢l⁢e⁢(x) ≫

8. Sign off

Finished? Or something else to do? then sign off using

q⁢u⁢i⁢t ≫