wrong solutions in system of nonlinear equations with "vpasolve"
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I am a beginner of Matlab.
I tried to solve a system of nonlinear equations (8 equation and 6 variables) with vpasolve as shown below.
The solutions do not satisfy 4 out of 8 equations. (Wrong solutions and equations that are not satisfied with the solutions are with bold letters.)
How can I fix the problem?
*Code I used
//
>> syms A B C D E x
eq1=B+C+7.5-100
eq2=A+C+E+7.5-135
eq3=D+E+7.5-15
eq4=0.7*C + x*E - A*(B+D)
eq5=0.7*(C+7.5)-B*(A+E)
eq6=0.7*C-x*7.5-(A*B-C*D)
eq7=x*(E+7.5)-D*(A+C)
eq8=x*E-0.7*7.5-(A*D-B*E)
eqs=[eq1, eq2, eq3, eq4, eq5, eq6, eq7, eq8]
[A, B, C, D, E, x]=vpasolve(eqs, [A,B,C, D, E, x])
//
*Response I got
//
eq1 = B + C - 185/2
eq2 = A + C + E - 255/2
eq3 = D + E - 15/2
eq4 = (7*C)/10 + E*x - A*(B + D)
eq5 = (7*C)/10 - B*(A + E) + 21/4
eq6 = (7*C)/10 - (15*x)/2 - A*B + C*D
eq7 = x*(E + 15/2) - D*(A + C)
eq8 = E*x - A*D + B*E - 21/4
eqs = [ B + C - 185/2, A + C + E - 255/2, D + E - 15/2, (7*C)/10 + E*x - A*(B + D), (7*C)/10 - B*(A + E) + 21/4, (7*C)/10 - (15*x)/2 - A*B + C*D, x*(E + 15/2) - D*(A + C), E*x - A*D + B*E - 21/4]
A =
34.046247300863523845963342329846
29.073162677776520552338619357279
-2.4237473008635238459633423298465
-6.8461164144313248228012528092361
B =
1.8635105955281338875279376538881
1.8635105955281338875279376538881
-37.563510595528133887527937653888
-37.563510595528133887527937653888
C =
90.636489404471866112472062346112
90.636489404471866112472062346112
130.06351059552813388752793765389
130.06351059552813388752793765389
D =
4.6827367053353899584354046759584
-0.29034791775161333518931829660926
7.6397632946646100415645953240416
3.217394181096809064726684844652
E =
2.8172632946646100415645953240416
7.7903479177516133351893182966093
-0.13976329466461004156459532404161
4.282605818903190935273315155348
x =
56.590242103608342266508720016265
-2.2731626777765205523386193572788
132.48725789639165773349127998373
33.646116414431324822801252809236
//
0 commentaires
Réponses (1)
Nagasai Bharat
le 20 Oct 2020
Hi,
There is an syntax error in how the "vpasolve" function is being solved. Do look in the below snippet for correct syntax.
syms A B C D E x
eq1=B+C+7.5-100;
eq2=A+C+E+7.5-135;
eq3=D+E+7.5-15;
eq4=0.7*C + x*E - A*(B+D);
eq5=0.7*(C+7.5)-B*(A+E);
eq6=0.7*C-x*7.5-(A*B-C*D);
eq7=x*(E+7.5)-D*(A+C);
eq8=x*E-0.7*7.5-(A*D-B*E);
[A, B, C, D, E, x]= vpasolve(eq1 == 0, eq2 == 0, eq3 == 0, eq4== 0, eq5== 0, eq6== 0, eq7== 0, eq8== 0, [A,B,C, D, E, x])
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!