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