System of equations solved numerically
Show older comments
Given the system of equations below, solve for the value of each letter using the numeric technique (not symbolic).
A + A + B + B = 63
A + B + C + D = 40
A + E + E + B = 15
A + C + C + D = 26
E + B + C + D = 33
This is the question. My code is below. (green is just explanation/notes of the code if it wasn't clear)

I got an answer of
A =-1.25
B =32.75
C =18.75
D = -10.25
E =-8.25
Is my code set up correctly to solve numerically? I think it is just want a reaffirmation. Thanks
Answers (1)
Ameer Hamza
on 8 Oct 2020
Edited: Ameer Hamza
on 8 Oct 2020
Yes, technically vpasolve() gives a numerical solution, you have met the requirement. However, if you want to avoid symbolic altogether, then use MATLAB native operator mldivide (\). https://www.mathworks.com/help/matlab/ref/mldivide.html
% cofficients of A B C D and E in each equation
A = [2 2 0 0 0;
1 1 1 1 0;
1 1 0 0 2;
1 0 2 1 0;
0 1 1 1 1];
% RHS of the equations
B = [63; 40; 15; 26; 33];
sol = A\B; % values of A B C D E
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!