How to find the solution for the system of equations
1 view (last 30 days)
Show older comments
I am trying to find the value of 14 variables using 14 system of equation but i am not getting the answer using solve() command (this is the value: val =Empty sym: 0-by-1 I am getting )
I have decalred lambda as 14x1 sym
lambda = sym('lambda', [14 1]) ;
%having contraint as lambda>=0
lambda =
lambda1
lambda2
lambda3
lambda4
lambda5
lambda6
lambda7
lambda8
lambda9
lambda10
lambda11
lambda12
lambda13
lambda14
equ=[65*lambda8 - 102*lambda2 - 121*lambda3 - 126*lambda4 - 114*lambda5 - 88*lambda6 - 150*lambda7 - 113*lambda1 + 85*lambda9 + 91*lambda10 + 60*lambda11 + 74*lambda12 + 29*lambda13 + 51*lambda14 + 1 == 0...
,78*lambda8 - 116*lambda2 - 106*lambda3 - 128*lambda4 - 96*lambda5 - 96*lambda6 - 140*lambda7 - 102*lambda1 + 62*lambda9 + 78*lambda10 + 56*lambda11 + 76*lambda12 + 34*lambda13 + 58*lambda14 + 1 == 0...
,67*lambda8 - 106*lambda2 - 130*lambda3 - 133*lambda4 - 123*lambda5 - 92*lambda6 - 160*lambda7 - 121*lambda1 + 93*lambda9 + 98*lambda10 + 64*lambda11 + 78*lambda12 + 30*lambda13 + 53*lambda14 + 1 == 0...
, 84*lambda8 - 128*lambda2 - 133*lambda3 - 149*lambda4 - 123*lambda5 - 108*lambda6 - 170*lambda7 - 126*lambda1 + 86*lambda9 + 99*lambda10 + 68*lambda11 + 88*lambda12 + 37*lambda13 + 64*lambda14 + 1 == 0...
,60*lambda8 - 96*lambda2 - 123*lambda3 - 123*lambda4 - 117*lambda5 - 84*lambda6 - 150*lambda7 - 114*lambda1 + 90*lambda9 + 93*lambda10 + 60*lambda11 + 72*lambda12 + 27*lambda13 + 48*lambda14 + 1 == 0...
, 64*lambda8 - 96*lambda2 - 92*lambda3 - 108*lambda4 - 84*lambda5 - 80*lambda6 - 120*lambda7 - 88*lambda1 + 56*lambda9 + 68*lambda10 + 48*lambda11 + 64*lambda12 + 28*lambda13 + 48*lambda14 + 1 == 0...
, 90*lambda8 - 140*lambda2 - 160*lambda3 - 170*lambda4 - 150*lambda5 - 120*lambda6 - 200*lambda7 - 150*lambda1 + 110*lambda9 + 120*lambda10 + 80*lambda11 + 100*lambda12 + 40*lambda13 + 70*lambda14 + 1 == 0...
,65*lambda1 + 78*lambda2 + 67*lambda3 + 84*lambda4 + 60*lambda5 + 64*lambda6 + 90*lambda7 - 53*lambda8 - 37*lambda9 - 49*lambda10 - 36*lambda11 - 50*lambda12 - 23*lambda13 - 39*lambda14 + 1 == 0...
, 85*lambda1 + 62*lambda2 + 93*lambda3 + 86*lambda4 + 90*lambda5 + 56*lambda6 + 110*lambda7 - 37*lambda8 - 73*lambda9 - 71*lambda10 - 44*lambda11 - 50*lambda12 - 17*lambda13 - 31*lambda14 + 1 == 0...
,91*lambda1 + 78*lambda2 + 98*lambda3 + 99*lambda4 + 93*lambda5 + 68*lambda6 + 120*lambda7 - 49*lambda8 - 71*lambda9 - 74*lambda10 - 48*lambda11 - 58*lambda12 - 22*lambda13 - 39*lambda14 + 1 == 0...
, 60*lambda1 + 56*lambda2 + 64*lambda3 + 68*lambda4 + 60*lambda5 + 48*lambda6 + 80*lambda7 - 36*lambda8 - 44*lambda9 - 48*lambda10 - 32*lambda11 - 40*lambda12 - 16*lambda13 - 28*lambda14 + 1 == 0...
, 74*lambda1 + 76*lambda2 + 78*lambda3 + 88*lambda4 + 72*lambda5 + 64*lambda6 + 100*lambda7 - 50*lambda8 - 50*lambda9 - 58*lambda10 - 40*lambda11 - 52*lambda12 - 22*lambda13 - 38*lambda14 + 1 == 0...
,29*lambda1 + 34*lambda2 + 30*lambda3 + 37*lambda4 + 27*lambda5 + 28*lambda6 + 40*lambda7 - 23*lambda8 - 17*lambda9 - 22*lambda10 - 16*lambda11 - 22*lambda12 - 10*lambda13 - 17*lambda14 + 1 == 0...
, 51*lambda1 + 58*lambda2 + 53*lambda3 + 64*lambda4 + 48*lambda5 + 48*lambda6 + 70*lambda7 - 39*lambda8 - 31*lambda9 - 39*lambda10 - 28*lambda11 - 38*lambda12 - 17*lambda13 - 29*lambda14 + 1 == 0]
lambda_val = solve(equ,[lambda]);
%% But its not giving any value for lambda
0 Comments
Accepted Answer
Stephan
on 23 Nov 2020
Edited: Stephan
on 23 Nov 2020
Your system is inconstistent and therefore there is no solution:
% x is shorter than lambda
x = sym('x', [14 1]) ;
% system as equations
equ=[65*x(8) - 102*x(2) - 121*x(3) - 126*x(4) - 114*x(5) - 88*x(6) - 150*x(7) - 113*x(1) + 85*x(9) + 91*x(10) + 60*x(11) + 74*x(12) + 29*x(13) + 51*x(14) + 1 == 0;
78*x(8) - 116*x(2) - 106*x(3) - 128*x(4) - 96*x(5) - 96*x(6) - 140*x(7) - 102*x(1) + 62*x(9) + 78*x(10) + 56*x(11) + 76*x(12) + 34*x(13) + 58*x(14) + 1 == 0;
67*x(8) - 106*x(2) - 130*x(3) - 133*x(4) - 123*x(5) - 92*x(6) - 160*x(7) - 121*x(1) + 93*x(9) + 98*x(10) + 64*x(11) + 78*x(12) + 30*x(13) + 53*x(14) + 1 == 0;
84*x(8) - 128*x(2) - 133*x(3) - 149*x(4) - 123*x(5) - 108*x(6) - 170*x(7) - 126*x(1) + 86*x(9) + 99*x(10) + 68*x(11) + 88*x(12) + 37*x(13) + 64*x(14) + 1 == 0;
60*x(8) - 96*x(2) - 123*x(3) - 123*x(4) - 117*x(5) - 84*x(6) - 150*x(7) - 114*x(1) + 90*x(9) + 93*x(10) + 60*x(11) + 72*x(12) + 27*x(13) + 48*x(14) + 1 == 0;
64*x(8) - 96*x(2) - 92*x(3) - 108*x(4) - 84*x(5) - 80*x(6) - 120*x(7) - 88*x(1) + 56*x(9) + 68*x(10) + 48*x(11) + 64*x(12) + 28*x(13) + 48*x(14) + 1 == 0;
90*x(8) - 140*x(2) - 160*x(3) - 170*x(4) - 150*x(5) - 120*x(6) - 200*x(7) - 150*x(1) + 110*x(9) + 120*x(10) + 80*x(11) + 100*x(12) + 40*x(13) + 70*x(14) + 1 == 0;
65*x(1) + 78*x(2) + 67*x(3) + 84*x(4) + 60*x(5) + 64*x(6) + 90*x(7) - 53*x(8) - 37*x(9) - 49*x(10) - 36*x(11) - 50*x(12) - 23*x(13) - 39*x(14) + 1 == 0;
85*x(1) + 62*x(2) + 93*x(3) + 86*x(4) + 90*x(5) + 56*x(6) + 110*x(7) - 37*x(8) - 73*x(9) - 71*x(10) - 44*x(11) - 50*x(12) - 17*x(13) - 31*x(14) + 1 == 0;
91*x(1) + 78*x(2) + 98*x(3) + 99*x(4) + 93*x(5) + 68*x(6) + 120*x(7) - 49*x(8) - 71*x(9) - 74*x(10) - 48*x(11) - 58*x(12) - 22*x(13) - 39*x(14) + 1 == 0;
60*x(1) + 56*x(2) + 64*x(3) + 68*x(4) + 60*x(5) + 48*x(6) + 80*x(7) - 36*x(8) - 44*x(9) - 48*x(10) - 32*x(11) - 40*x(12) - 16*x(13) - 28*x(14) + 1 == 0;
74*x(1) + 76*x(2) + 78*x(3) + 88*x(4) + 72*x(5) + 64*x(6) + 100*x(7) - 50*x(8) - 50*x(9) - 58*x(10) - 40*x(11) - 52*x(12) - 22*x(13) - 38*x(14) + 1 == 0;
29*x(1) + 34*x(2) + 30*x(3) + 37*x(4) + 27*x(5) + 28*x(6) + 40*x(7) - 23*x(8) - 17*x(9) - 22*x(10) - 16*x(11) - 22*x(12) - 10*x(13) - 17*x(14) + 1 == 0;
51*x(1) + 58*x(2) + 53*x(3) + 64*x(4) + 48*x(5) + 48*x(6) + 70*x(7) - 39*x(8) - 31*x(9) - 39*x(10) - 28*x(11) - 38*x(12) - 17*x(13) - 29*x(14) + 1 == 0];
% Return a linear system as matrix
[A,b] = equationsToMatrix(equ)
% solve the linear system
lambda = A\b
More Answers (1)
See Also
Categories
Find more on Equation Solving 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!