Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Solving non-linear and linear simultaneous equations with fsolve 1.0

Date Added: July 24, 2013  |  Visits: 209

solvesimul.m can be easily adapted to solve more equations but as it stands it will solve 2 unknowns in 2 equations (1 non-linear and one linear).To solve equations of this form... a*x + b*y = A (1) a1*x^2 + b1*y^2 = B (2)...with fsolve (used by solvesimul.m) you need to rewrite them so that they equal zero.so (1) and (2) become a*x + b*y - A = 0 (1a) a1*x^2 + b1*y^2 - B = 0 (2a)then using a nested function approach (there are many other ways) you can solve some system of non-linear equations.An example, 2*x + 3*y - 8 = 0 4*x^2 + 5*y^2 - 24 = 0At the MATLAB command-line prompt you run the 'solvesimul' m-file function with the correct argumentsi.e. coefficients and constants in the equations in the appropriate order.NB: please see final note below demo of the solvesimul command.>> b=solvesimul(2,3,4,5,8,24); 1.0e-014 * 0 0.7105>> bb = 1.0000 2.0000These are the solutions for the 2 equations i.e. x = 1, y=2.----------------------------------------------------------------The code I wrote for 'solvesimul' is attached. Save it to your working folder and run as above.NB: you can use any one of the 3 fsolve formats by commenting out the other 2 you don't need in the attached m-file code.Important:You need to enter the args (i.e equation coefficients) to solvesimul.m in the order they appear in the equations with equation constants specified last in the correct order.

 Requirements: No special requirements Platforms: Matlab Keyword: 1a A1x2,  20000these Are,  24 3d,  2b 3y,  2b 5y2,  2b B1y2,  2b By,  2x 2b,  3d 0at,  3d 10000,  4x2 2b,  5y2 24,  A1x2 2b,  Abovenb,  Adapted,  And One,  Athen,  Constants,  Fsolve,  Run Users rating: 0/10