How to solve equation system?
古いコメントを表示
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
2014 年 4 月 29 日
0 投票
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 件のコメント
Star Strider
2014 年 4 月 29 日
Doubt it’s homework. Autoliv produces crash prevention technology.
Adrian
2014 年 5 月 7 日
Image Analyst
2014 年 5 月 7 日
No. It looks like I was assuming that you had a lest squares situation but I don't know if you do anymore since some terms are related, like b*d and so on. So I think it might be a partial least squares or something. I'm not really super knowledgeable about that so perhaps you should follow Star's advice, if you can. Or maybe use something from the Optimization Toolbox, which I don't have. I don't know what Autoliv is or why Start mentioned it.
Star Strider
2014 年 5 月 7 日
@Image Analyst — I mentioned Autoliv because when you raised the possibility of homework, I clicked on Adrian’s profile to see if homework was a possibility, and looked at his email address. Didn’t seem to be homework, but a work-related problem.
It possibly could be cast as a sparse linear regression problem, except that it would then be underdetermined and would not likely yield useful parameter estimates.
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
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
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 件のコメント
Adrian
2014 年 5 月 7 日
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
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.
カテゴリ
ヘルプ センター および File Exchange で Linear Algebra についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!