How to solve equation system?
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (2개)
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
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
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!