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

Réponses (2)

Image Analyst
Image Analyst le 29 Avr 2014

0 votes

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

Star Strider
Star Strider le 29 Avr 2014
Doubt it’s homework. Autoliv produces crash prevention technology.
Adrian
Adrian le 7 Mai 2014
@Star Strider: home work only, take advantage of matlab from work. @Image Analyst: got something like this: A = [5.036*a 44.6622*b 0 0 0 0 0 0 a^2 b^2 0 0 504.47075121;0 0 5.036*c 44.6622*d 0 0 0 0 0 0 c^2 d^2 500.44235121;0 0 0 0 2*a*c 0 0 2*b*d a^2 b^2 c^2 d^2 3.61;24.8491*a 0 -22.3311*c 2.518*d 0 -a*d b*c 0 0 0 0 0 0.703]; I am new to matlab so i dont know exactl if is corect and how to proceed further. Thank you anyway.
Image Analyst
Image Analyst le 7 Mai 2014
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
Star Strider le 7 Mai 2014
@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
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
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.

Connectez-vous pour commenter.

Star Strider
Star Strider le 29 Avr 2014

0 votes

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

Adrian
Adrian le 7 Mai 2014
fsolve seems to be not implemented on Matlab 2012b version.
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 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.

Connectez-vous pour commenter.

Question posée :

le 29 Avr 2014

Community Treasure Hunt

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

Start Hunting!

Translated by