Solve for variable x in a matrix with matlab
이전 댓글 표시
I want to use matlab to solve for x in this matrix:
A= [ 1 x 1 0 0 0 ;
0 1 x 1 0 0 ;
0 0 1 x 1 1 ;
0 0 0 1 x 1 ;
1 0 0 0 1 x ]
댓글 수: 2
BuckeyeLink
2015년 11월 5일
John D'Errico
2015년 11월 6일
Sigh. solve for the determinant when the matrix is equal to zero? Again. no mathematical meaning in that comment.
You can have a determinant of a matrix, but not a non-square matrix.
You cannot have the determinant of an equality, so asking for the determinant when the matrix is equal to zero is meaningless in terms of mathematics.
Maybe you meant to solve for x, such that the determinant of A is zero. But that too is meaningless, since A is non-square.
채택된 답변
추가 답변 (1개)
John D'Errico
2015년 11월 5일
편집: John D'Errico
2015년 11월 6일
Solve what? A variable is just that, an unknown number. A matrix is just a collection of numbers. You have posed no equality statement, so there is no solution to be found.
Had you given some relationship that involves A. For example, solve for x, such that A is singular, or that A has a minimum norm, or that norm(A*ones(5,1)) is minimized, or any of a variety of equality statements, then we could talk about a solution. The solution might not be unique.
But as your question is posed, it is a meaningless question. There is no "solution".
Edit:
I'll assume that the real question is to solve for x, SUCH THAT the determinant, det(A(x))==0
I'll also assume that A is a square matrix, so I am forced to arbitrarily modify A so that can happen.
syms x
A= [ 1 x 1 0 0 0 ;
0 1 x 1 0 0 ;
0 0 1 x 1 1 ;
0 0 0 1 x 1 ;
1 0 0 0 1 x ;
0 1 0 0 0 1];
A is now a square matrix.
p = det(A)
p =
2*x^4 - 6*x^2 + 4
solve(p == 0)
ans =
-1
1
2^(1 / 2)
-2^(1 / 2)
Finally, IF by secular equation, you intend to solve for the roots of the characteristic polynomial, in theory, this would be done as follows:
syms lambda
P = det(A - lambda*eye(6))
P =
lambda^6 - 6*lambda^5 + 15*lambda^4 - lambda^3*x - 22*lambda^3 - 6*lambda^2*x^2 + 3*lambda^2*x + 21*lambda^2 - 2*lambda*x^4 + 12*lambda*x^2 - 3*lambda*x - 12*lambda + 2*x^4 - 6*x^2 + 4
solve(P == 0,lambda)
ans =
root(z^6 - 6*z^5 + 15*z^4 - z^3*(x + 22) + z^2*(3*x - 6*x^2 + 21) - z*(3*x - 12*x^2 + 2*x^4 + 12) - 6*x^2 + 2*x^4 + 4, z, 1)
root(z^6 - 6*z^5 + 15*z^4 - z^3*(x + 22) + z^2*(3*x - 6*x^2 + 21) - z*(3*x - 12*x^2 + 2*x^4 + 12) - 6*x^2 + 2*x^4 + 4, z, 2)
root(z^6 - 6*z^5 + 15*z^4 - z^3*(x + 22) + z^2*(3*x - 6*x^2 + 21) - z*(3*x - 12*x^2 + 2*x^4 + 12) - 6*x^2 + 2*x^4 + 4, z, 3)
root(z^6 - 6*z^5 + 15*z^4 - z^3*(x + 22) + z^2*(3*x - 6*x^2 + 21) - z*(3*x - 12*x^2 + 2*x^4 + 12) - 6*x^2 + 2*x^4 + 4, z, 4)
root(z^6 - 6*z^5 + 15*z^4 - z^3*(x + 22) + z^2*(3*x - 6*x^2 + 21) - z*(3*x - 12*x^2 + 2*x^4 + 12) - 6*x^2 + 2*x^4 + 4, z, 5)
root(z^6 - 6*z^5 + 15*z^4 - z^3*(x + 22) + z^2*(3*x - 6*x^2 + 21) - z*(3*x - 12*x^2 + 2*x^4 + 12) - 6*x^2 + 2*x^4 + 4, z, 6)
Of course, it must fail, since this is a polynomial of order higher than 4, with non-constant coefficients. So we cannot solve it.
You need to explain your problem CLEARLY.
댓글 수: 2
BuckeyeLink
2015년 11월 5일
John D'Errico
2015년 11월 6일
Still meaningless. The matrix is not square. eigenvalues are undefined for non-square matrices.
카테고리
도움말 센터 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!