How to solve equation system?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a system of 4 equations with 4 variables:
a^2 + b^2 + 5.036a + 44.6622b = 504.47075121
c^2 + d^2 + 5.036c + 44.6622d = 500.44235121
a^2 + b^2 + c^2 + d^2 + 2ac + 2bd = 3.61
2.518d + 22.3311a + bc - ad -22.3311c + 2.518a = 0.703
Is there any simple way to solve this in Matlab 2012b version? Thank you
0 commentaires
Réponses (2)
Image Analyst
le 29 Avr 2014
Is this homework? Can you write out the matrices associated with the system? Make sure the letters line up first, like all the a's in column 1, all the b's in column 2, all the a^2 in column 5, all the a*d in another column, all the constants in their own column vector, etc. Then use inv() or the backslash operator to solve.
6 commentaires
Image Analyst
le 7 Mai 2014
I still don't know what Autoliv is. From Google it seems to be an automobile safety company.
Star Strider
le 7 Mai 2014
Modifié(e) : Star Strider
le 7 Mai 2014
That was my impression. I surfed their website, out of interest when they seemed to be a technology company. They apparently got their start making farm tractors safer, then branched out. I think they invented the car safety belt (lap belt).
-----------
On a completely different note, I was off by a factor of 10 in what I remembered as the earth circumference. It’s 4E7, not 4E6. With that, my calculations agree with yours.
Star Strider
le 29 Avr 2014
Use fsolve:
% Set p(1) = a, p(2) = b, p(3) = c, p(4) = d
Eqs = @(p) [p(1).^ + p(2).^2 + 5.036.*p(1) + 44.6622.*p(2) - 504.47075121;
p(3).^ + p(4).^2 + 5.036.*p(3) + 44.6622.*p(4) - 500.4423512;
p(1).^2 + p(2).^2 + p(3).^2 + p(4).^2 + 2.*p(1).*p(3) + 2.*p(2).*p(4) - 3.61;
2.518.*p(4) + 22.3311.*p(1) + p(2).*p(3) - p(1).*p(4) + 22.3311.*p(3) + 2.518.*p(1) - 0.703];
P = fsolve(Eqs, ones(4,1))
produces:
P =
2.0566e+000
3.9860e+000
1.8606e+000
4.5529e+000
3 commentaires
Alan Weiss
le 7 Mai 2014
fsolve is in Optimization Toolbox. To check whether you have a license for this toolbox, enter
ver
at the MATLAB command line.
Alan Weiss
MATLAB mathematical toolbox documentation
Star Strider
le 7 Mai 2014
@Adrian — If all else fails, you could write a simple genetic algorithm to solve it. Your fitness function would test to see how close to [0 0 0 0]' the solution to Eqns is. It won’t converge as quickly as fsolve but will probably converge reasonably rapidly.
Voir également
Catégories
En savoir plus sur Linear Algebra 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!