Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

nonlinear systems of equations

Status
Not open for further replies.

moujail

Chemical
Joined
Sep 15, 2005
Messages
2
Location
FR
Hi everybody,

I am a biginner in Matlab (Release 13)
I have to resolve the following non linear systems of equations:

5.387=k1+k2+k3+3.92
0.022=sqrt{5.387-4*[k3*(3.92+k2)+k1*(k2+k3)]}
1.51326= {3.92+k1+k2+k4+sqrt[(3.92+k1+k2+k4)^2-4*k1*(k2+k4)]}/2
1.52376={3.92+k1+k2+k4-sqrt[(3.92+k1+k2+k4)^2-4*k1*(k2+k4)]}/2

May somebody help me???
Thanks
 
use fsolve.

i wont be able to give the syntax better than the tutorial, so i suggest you try there, but here:

make an m file with your functions:
-------------------------------------------------------
function F = funcs(k)

F = [k(1)+k(2)+k(3)+3.92-5.387;
sqrt(5.387-4*(k(3)*(3.92+k(2))+k1*(k(2)+k(3))))-0.022;
(3.92+k(1)+k(2)+k(4)+sqrt((3.92+k(1)+k(2)+k(4))^2-4*k(1)*(k(2)+k(4))))/2 - 1.51326;
(3.92+k(1)+k(2)+k(4)-sqrt((3.92+k(1)+k(2)+k(4))^2-4*k(1)*(k2+k(4))))/2 - 1.52376;]

end
-------------------------------------------------------
in the command, you will need to make a starting guess. I will leave that up to you and just put all 1's.
-------------------------------------------------------
guess[1 1 1 1];
fsolve(@funcs,guess);
-------------------------------------------------------
I think this should work. Try it out. I think when you mean to use parenthesis, only use parenthesis. Dont use square or regular brackets. They denote something else entirely. Notice that I moved the values on one side of the equations to the other so that it equals 0. If this doesnt work, consult the Matlab help. Look up fsolve. I just started using it myself, so I might have missed something.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top