find unknown value in matrix using MATLAB [closed]
a= 1-b -1 0;
-1 3-1.5b -2;
0 -2 5-2b
if determinant of matrix a equal zero, then whats the value of b? 开发者_C百科If the matrix is 6 by 6,then what will be process? Please write the instruction in MATLAB.
With the definition of the determinant, you can reformulate the problem as finding the roots of an nth polynomial. Either do it by hand (easy for the 3x3 case) or use the symbolic math toolbox to do it. Then you can use the MATLAB roots
function to solve it.
You can solve this in one shot with Matlab using generalized eigenvectors as follows:
1-b -1 0;
-1 3-1.5b -2;
0 -2 5-2b
can be rewritten as A + b * B
where
A = [ 1 -1 0
-1 3 -2
0 -2 5];
and B = diag([-1 -1.5 -2])
Then you solve for the possible values of b
with
[v,d] = eig(A,-B)
And the answers are in the diagonals of d:
0.351464727818363 0 0
0 1.606599092463833 0
0 0 3.541936179717803
if the determinant of a matrix is zero, it is a singular matrix and you cannot solve it with simple linear algebra techniques. You most likely have dependent equations that are making up the matrix a, but not enough data to see that. I would recommend using Jacobi Iteration to solve this type of problem.
But if you don't give us enough details or original code to work with, we really can't help you.
精彩评论