Matlab_tutorial_1_F06

# Matlab_tutorial_1_F06 - Department of Chemical Engineering...

This preview shows pages 1–3. Sign up to view the full content.

1 Department of Chemical Engineering University of California, Santa Barbara Ch. E. 152A Fall, 2006 MATLAB Handout #1 The purpose of this MATLAB session is to introduce the basic functionality of the software and to enable you to solve simple ordinary differential equation problems (ODEs). The basics of vector and matrix manipulations will be covered; then it will be shown how simple linear equations can be solved using MATLAB. The basics of functions and scripts will be described next. Finally, the use of the ODE integrator function, ode45 will be considered. Next week’s lesson will introduce the graphical modeling tool, SIMULINK. . In this report, boldface expressions denote MATLAB commands. 1. Vectors Square brackets denote vectors or matrices, and a semicolon at the end of a line suppresses the output from being shown. Elements in row vectors are separated by spaces or commas. v = [v 1 v 2 v 3 ] Elements in column vectors are separated by semicolons: v = [v 1 ; v 2 ; v 3 ] 2. Matrices Columns are separated by spaces or commas, rows are separated by semicolons. M = [m 11 m 12 ; m 21 m 22 ] The transpose of a matrix M is calculated using the command: . M The inverse of a matrix M is calculated as inv(M) . For more functions and help on any Matlab operation, type help .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Consider the following matrices: 13 5 2 02 14 12 2 3 24 1 4 AB CD ⎤⎡ == ⎥⎢ ⎦⎣ ⎡⎤ ⎢⎥ −− ⎣⎦ Calculate the following: a) AB b) AB T c) A -1 d) DCD T e) C -1 f) (ADA T ) -1 g) BC – D -1 Other matrix operations: eigenvalues and eigenvectors: eig(M) singular value decomposition: svd(M) pseudoinverse: pinv(M) 3. Solution to algebraic linear equations Using the functions considered above, simple linear algebraic equations can be easily solved. Solve the equation Mx = b for: a) M = A, b=[1; 2] b) M = B, b=[1; 2] c) M = ADA T , b=[5 1]´.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

Matlab_tutorial_1_F06 - Department of Chemical Engineering...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online