0% found this document useful (0 votes)
33 views

Mathlabb

This document contains 20 code blocks that perform matrix operations and linear algebra calculations including: - Substituting a matrix into a polynomial function - Solving for a variable in a matrix determinant equation - Calculating the determinant and inverse of several matrices - Checking the rank of matrices to determine if a system of equations has a unique solution, no solution, or infinitely many solutions
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Mathlabb

This document contains 20 code blocks that perform matrix operations and linear algebra calculations including: - Substituting a matrix into a polynomial function - Solving for a variable in a matrix determinant equation - Calculating the determinant and inverse of several matrices - Checking the rank of matrices to determine if a system of equations has a unique solution, no solution, or infinitely many solutions
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

11.

syms m x
A = [2 1 1; 3 1 2; 1 -1 0]
f(x)= x^2 - 2*x - 3
subs(f(A))

12.
syms m
A=[3 -2 6;5 1 4;3 1 1]
B=[1 1 -1;0 2 5;1 -2 m]
[m]=solve(det(A*B))

13.
A=[-1 3 2;2 1 0;4 3 1]
det(A)*inv(A)

14.
syms m
disp('matrix A: ');
A = [1 2 1;2 3 m;3 2 -1]
disp('matrix B: ');
B = [1 1 1;2 3 2;5 7 5]
if (det(A*B) == 0) disp('Invertible with all m')
else
disp('gia tri m can tim: ')
solve(det(A*B))
end

15.
A=[2 3 1;3 4 2;5 3 -1]
det(A)*inv(A)

16.
A=[1 1 2 1;2 3 4 5;3 4 6 9]
rref(A)

17.
A=[3 -1;5 -2]
B=[5 6;7 8]
X=inv(A)*B
18.
A=[0 -8 3;1 -5 9;2 3 8]
B=[23 -30; -2 -26; -26 7]
X=inv(A)*B

19.
A=[1 2 3 4; 2 1 2 3; 3 2 1 2; 4 3 0 1]
B=[7;6;7;8]
a=rank(A)
b=rank([A B])
[n, m] = size(A);
if (a < b)
disp('No solution')
elseif (a == b & a ==n)
disp('Unique solution')
else
disp('a = b < n =>> Has many solution')
end

20.
A=[1 2 -3 5; 1 3 -13 22; 3 5 1 -2; 2 3 4 -7]
B=[1;-1;5;4]
a=rank(A)
b=rank([A B])
[n, m] = size(A);
if (a < b)
disp('No solution')
elseif (a == b & a ==n)
disp('Unique solution')
else
disp('a = b < n =>> Has many solution')
n
end

You might also like