How to solve equation system?

4 ビュー (過去 30 日間)
Adrian
Adrian 2014 年 4 月 29 日
編集済み: Star Strider 2014 年 5 月 7 日
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

回答 (2 件)

Image Analyst
Image Analyst 2014 年 4 月 29 日
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 件のコメント
Image Analyst
Image Analyst 2014 年 5 月 7 日
I still don't know what Autoliv is. From Google it seems to be an automobile safety company.
Star Strider
Star Strider 2014 年 5 月 7 日
編集済み: Star Strider 2014 年 5 月 7 日
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
Star Strider 2014 年 4 月 29 日
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 件のコメント
Alan Weiss
Alan Weiss 2014 年 5 月 7 日
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
Star Strider 2014 年 5 月 7 日
@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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by