Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Solution1.m
- E =eye(3)
- u = E(:,1)
- E(3,1) = 5
- v = E*u
- A = ones(3) + eye(3)
- b = A(:,3)
- C = inv (A)
- x = A\b
- x = C*b
- %This is a comment
- %help slsh
- %last line was a comment
- help slash
- %"help slash" last line was ignored :O
- %but it works in the console
- %Edit : it works! I actually forgot to save the file :p
- u = [2 4 5]
- v = [2;4;5]
- v = [2 4 5]'
- w= 2:5
- u= 1:2:7
- A = [1 2 3; 4 5 6]
- A = [1 2 3
- 4 5 6]
- %both last two commands work as expected >.>
- B = [1 2 3; 4 5 6]'
- %created [1 2 3; 4 5 6] first, transposed it and put it into B
- diag(v)
- disp("toeplitz(v):")
- toeplitz(v)
- disp("toeplitz(w):")
- toeplitz(w)
- disp("toeplitz(w,v):")
- toeplitz(w,v)
- disp("ones(5)")
- ones(5)
- zeros(7)
- eye(10)
- rand(5)
- randn(5)
- disp("ones (4,7)")
- ones(4,7)
- disp("size(A):")
- size(A)
- %probably next command shall make ones with 2 rows and 3 collumns
- disp("ones size(A):")
- ones (size(A))
- %it did!
- zeros(size(A))
- %will next command excecute? A is 2x3
- eye(size(A))
- %IT DID!
- A(3,2) = 7
- %A NEW ROW IS CREATED!
- % --> A(3,:) = w
- %Error occured since w is 1 X 4
- A(3,:) = v
- % A(:,2) = w error occured since w is 1X4 but col 2 of A has 3 elements
- A([2 3],:) = A([3 2], :)
- A(2,2)
- A(1,:)
- A(:,3)
- A(1:3,2:3)
- A(:)
- triu(A)
- tril(A)
- disp("B:")
- B
- A*B
- %A.*B is not possible because A is 3x3 where B is 3x2
- A.*A'
- inv (A)
- pinv(A)
- A\v
- inv(A)*v
- det(A)
- rank(A)
- size(A)
- trace(A)
- null(A)
- orth(A)
- E = eye(4)
- E(2,1) = -3
- E*(ones(4))
- [L,U,P] = lu(A)
- e = eig(A)
- [S,E] = eig(A)
- [Q,R] = qr(A)
- plot(v)
- x= A(:,2)
- y = L(:,1)
- disp("plot");
- plot(x,y)
- disp("plot red +");
- plot (x,y,'r+:')
- disp("plot --");
- plot (x,y,'--')
- plot(x,y,'o')
- loglog(x,y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement