linear system of equations
Show older comments
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 Comments
KALYAN ACHARJYA
on 29 Aug 2018
x1,x2?
antlhem
on 29 Aug 2018
antlhem
on 29 Aug 2018
Star Strider
on 29 Aug 2018
If you do:
RankA = rank(A)
RankA =
2
antlhem
on 29 Aug 2018
Accepted Answer
More Answers (0)
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!