Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Sol2
- %----- Q1 -----
- A = [2 3; 4 5]
- x = [1; -7]
- b = [24; 5]
- if A*x == b
- display("Ax equals b");
- else display ("Ax is not equal to b");
- end
- %----- Q2 -----
- A = eye(3)
- v = [3:5]'
- A*v
- %A*v = v
- v'*v
- %dot product of v and v which is 50
- %41833
- % v*A creates problem because v is 3X1 where A is 3x3; so multiplication is not possible
- %----- Q3 -----
- A = ones(4)
- v = ones(4,1)
- disp("A*v is: ")
- A*v
- B = eye(4) + ones(4)
- w = zeros(4,1) + 2*ones(4,1)
- disp("B*w =")
- B*w
- %----- Q4 -----
- P = pascal(4)
- inv(P)
- %----- Q5 -----
- L = abs(pascal(4,1))
- if P == L*L'
- disp("P equals LL'")
- else disp("P is not equal to LL'")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement