Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. % MATLAB Assignment 2 notes
  2. % Vectors and matrices
  3. a = [10 cosd(45) log(15) 0.1] % This is a row vector with 4 elements
  4. [10; cosd(45); log(15); 0.1] % This makes a column vector instead
  5. a' % apostrophe means transpose
  6. M = [1 2; 3 4; 5 6]
  7. M'
  8. % Auto-generate a vector, e.g [1 3 5 7 9 11 13 15]
  9. [1 : 2 : 15] % Separate with colon. Start at 1, go to 15, jump by 2
  10. M = [1 2 3; 4 5 6; 7 8 9]
  11. M(3,1)
  12. M(1:3, 3)
  13. M(1:2, 2:3) % See book p.45 bottom of page for more extensive example
  14. zeros(4,3) % Make a 4 x 3 block of zeros
  15. ones(2,6) % Make a 2 x 6 block of ones
  16. eye(5) % 5 x 5 "identity matrix"
  17. [ eye(2) zeros(2,1) ; ones(1,3)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement