Solve for variable x in a matrix with matlab
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
BuckeyeLink
el 5 de Nov. de 2015
Editada: Walter Roberson
el 6 de Nov. de 2015
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 comentarios
John D'Errico
el 6 de Nov. de 2015
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.
Respuesta aceptada
Star Strider
el 5 de Nov. de 2015
It looks to me that any arbitrary value would work, if that’s all the information you have.
2 comentarios
Star Strider
el 5 de Nov. de 2015
Editada: Star Strider
el 5 de Nov. de 2015
I had to look up ‘secular equation’. It seems it’s the characteristic polynomial of a square matrix (eigenvalues), but your matrix isn’t square.
I would put zeros in place of the ‘x’ values and use the eig function. See also Eigenvalues and Singlular Values for a comprehensive list of applicable functions.
EDIT — Consider using the Symbolic Math Toolbox.
Más respuestas (1)
John D'Errico
el 5 de Nov. de 2015
Editada: John D'Errico
el 6 de Nov. de 2015
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 comentarios
John D'Errico
el 6 de Nov. de 2015
Still meaningless. The matrix is not square. eigenvalues are undefined for non-square matrices.
Ver también
Categorías
Más información sobre Linear Algebra en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!