System of equations solved numerically

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

Réponses (1)

Ameer Hamza
Ameer Hamza le 8 Oct 2020
Modifié(e) : Ameer Hamza le 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

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by