linear system of equations
Mostra commenti meno recenti
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 Commenti
KALYAN ACHARJYA
il 29 Ago 2018
x1,x2?
antlhem
il 29 Ago 2018
antlhem
il 29 Ago 2018
Star Strider
il 29 Ago 2018
If you do:
RankA = rank(A)
RankA =
2
antlhem
il 29 Ago 2018
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Mathematics and Optimization in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
