structural analysis lec-2(07-02-2015)

24
Structural Analysis Lec-2

Upload: 2010civ164

Post on 14-Apr-2016

22 views

Category:

Documents


0 download

DESCRIPTION

This is Structural analysis first lecture on Matlab.In which we understand how to design different programs on matlab.

TRANSCRIPT

Page 1: Structural analysis Lec-2(07-02-2015)

Structural Analysis

Lec-2

Page 2: Structural analysis Lec-2(07-02-2015)

Contents Matrices Contd…

Matrix Indexing

Functions

1. Scalars

2. Vectors

Operators (Relation + Logical)

Plotting

Page 3: Structural analysis Lec-2(07-02-2015)

Some useful Matrices

eye Identity Matrix

zeros A matrix of zeros

ones A matrix of ones

diag Creating or extracting diagonals

rand Random matrix

Page 4: Structural analysis Lec-2(07-02-2015)

MATLAB Functions

Page 5: Structural analysis Lec-2(07-02-2015)

Some Predefined Matrices Random matrices

Matrix of zeros

Matrix of ones

Identity matrix

Diagonal matrix

rand(3)

rand(3,4)

Zeros(2,3)

Ones(10,1)

Eye(3)

diag(3,2)

Page 6: Structural analysis Lec-2(07-02-2015)

Matrix Indexing

Page 7: Structural analysis Lec-2(07-02-2015)

Advanced Indexing

Page 8: Structural analysis Lec-2(07-02-2015)
Page 9: Structural analysis Lec-2(07-02-2015)

Submatrices A=rand(5)

A (2 , 3)

A(1,end)

A(1:2 , 2:3)

A(1 , :)

A(7)

% Define Matrix

Specifying an element

Specifying contiguous submatrix

To specify entire first row

=A(2,2)

Row

Column

Page 10: Structural analysis Lec-2(07-02-2015)

Scalar Functions Some MATLAB functions applied to:

a. Scalars only

b. To all elements of vectors and matrices

Page 11: Structural analysis Lec-2(07-02-2015)

A=rand(3,4)

b=sqrt(A)

C=cos(A)

Note: We may extract a submatrix and then use these

functions

Page 12: Structural analysis Lec-2(07-02-2015)

Vector Functions Some MATLAB functions that operate on vectors only

Page 13: Structural analysis Lec-2(07-02-2015)

Matrix Functions Important Matrix Functions

Page 14: Structural analysis Lec-2(07-02-2015)

A=rand(3)

B=eig(A)

Sometimes such functions may use more than one

output function

[V,D]=eig(A)

Matrix whose columns are eigen vectors

Matrix whose diagonal values represents eigen values

Page 15: Structural analysis Lec-2(07-02-2015)

Matrix Operations

Matrix Addition

Matrix Subtraction

Matrix mutiplication

C=A+B

C=A-B

C=A*D

Page 16: Structural analysis Lec-2(07-02-2015)

Operators Some relation operators

Page 17: Structural analysis Lec-2(07-02-2015)

Logical Operators

• The result is either 0 or 1.

• Zero…if it is false

• One…If it is true

Page 18: Structural analysis Lec-2(07-02-2015)

Operators Precedence

Page 19: Structural analysis Lec-2(07-02-2015)

Plotting For 2D plots

Page 20: Structural analysis Lec-2(07-02-2015)

For 3D plots….use Plot3

Page 21: Structural analysis Lec-2(07-02-2015)

Exercise

Page 22: Structural analysis Lec-2(07-02-2015)
Page 23: Structural analysis Lec-2(07-02-2015)
Page 24: Structural analysis Lec-2(07-02-2015)