30.07.2015 Views

CTM: Matlab Basics Tutorial

CTM: Matlab Basics Tutorial

CTM: Matlab Basics Tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>CTM</strong>: <strong>Matlab</strong> <strong>Basics</strong> <strong>Tutorial</strong>http://www.engin.umich.edu/group/ctm/basic/basic.html6 of 9 05/11/2008 11:45E = [1 2;3 4]F = [2 3;4 5]G = E .* FE =F =1 23 42 34 5G =2 612 20If you have a square matrix, like E, you can also multiply it by itself as many times as you like by raising it toa given power.E^3ans =37 5481 118If wanted to cube each element in the matrix, just use the element-by-element cubing.E.^3ans =1 827 64You can also find the inverse of a matrix:X = inv(E)or its eigenvalues:X =-2.0000 1.00001.5000 -0.5000eig(E)ans =-0.37235.3723There is even a function to find the coefficients of the characteristic polynomial of a matrix. The "poly"function creates a vector that includes the coefficients of the characteristic polynomial.p = poly(E)p =1.0000 -5.0000 -2.0000

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!