linear system of equations
Afficher commentaires plus anciens
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 commentaires
KALYAN ACHARJYA
le 29 Août 2018
x1,x2?
antlhem
le 29 Août 2018
antlhem
le 29 Août 2018
Star Strider
le 29 Août 2018
If you do:
RankA = rank(A)
RankA =
2
antlhem
le 29 Août 2018
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Mathematics and Optimization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
