linear system of equations
Mostrar comentarios más antiguos
I have two arrays and both of them has variables, I am trying to use
linsolve
but no luck, since both have the variables and also some of the rows are just numbers. Is there a function in MATLAB R2017a that could solve this considering that both arrays have the variables to solve and numbers. My code and resutls are as follows:
x=sym('x', [1 4]);
%states = [ 1, 0, x1, x2, x1 + 1, x1 + x2, x2 + 1, 1, 0]
states = [ 1 0 x1 x2 x1 + 1 x1 + x2 x2 + 1 1 0];
%patt=[ 1, 0, x1, x2, x3, 1, 1, 1, x4]
patt=[ 1 0 x1 x2 x3 1 1 1 x4];
A=equationsToMatrix(states,x) %matrix of coefficients
B=transpose(patt) %constant terms
X=linsolve(A,B)%the solution

I know that the solution exist an is as follows, the question is how get this solution with MATLAB? I have much more arrays like this and I would like to optimise this process.

5 comentarios
KALYAN ACHARJYA
el 29 de Ag. de 2018
x1,x2?
antlhem
el 29 de Ag. de 2018
antlhem
el 29 de Ag. de 2018
Star Strider
el 29 de Ag. de 2018
If you do:
RankA = rank(A)
RankA =
2
antlhem
el 29 de Ag. de 2018
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Mathematics and Optimization en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
