How do I solve a system of simultaneous equations for x?

10 views (last 30 days)
-2.0x1 + 5.0x2 + 1.0x3 + 3.0x4 + 4.0x5 - 1.0x6 = 0.0;
2.0x1 - 1.0x2 - 5.0x3 - 2.0x4 + 6.0x5 + 4.0x6 = 1.0;

Answers (1)

Walter Roberson
Walter Roberson on 17 Sep 2015
A = [-2 +5 +1 +3 +4 -1;2 -1 -5 -2 +6 +4];
B = [0;1];
sols = A\B;
x1 = sols(1); x2 = sols(2); x3 = sols(3); x4 = sols(4); x5 = sols(5); x6 = sols(6);

This gives one solution out of the infinity.

Categories

Find more on Programming 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!