12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

q = [spiral(3) [10;20;30]]q =7 8 9 106 1 2 205 4 3 30>> q(end,end)ans =30>> q(2,end-1:end)ans =2 20>> q(end-2:end,end-1:end)ans =9 102 203 30>> q(end-1,:)ans =6 1 2 203.6 Deleting Rows or ColumnsTo get rid <strong>of</strong> a row or column set it equal to the empty matrix [].>> a = [1 2 3;4 5 6;7 8 9]a =1 2 34 5 67 8 9>> a(:,2) = []a =1 34 67 93.7 Matrix ArithmeticMatrices can be added <strong>and</strong> subtracted (they must be the same size).>> b = 10*ab =10 3040 6070 90c○ 2000 by CRC Press LLC

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

Saved successfully!

Ooh no, something went wrong!