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!