Solving non-linear (and linear) simultaneous equations with 'solve'

symsolvesimul.m solves non-linear and linear (or a mix of) simultaneous equations.

Vous suivez désormais cette soumission

symsolvesimul.m can be easily adapted to solve more equations but as it stands it will solve 2 unknowns in 2 non-linear equations (can be linear too or a mixture).

At the MATLAB command-line prompt you run the 'symsolvesimul' m-file function with the correct vector arguments i.e. exponents, coefficients and constants in the equations in the appropriate order.

...typing 'help symsolvesimul' like so for detailed help at the
MATLAB command-line prompt:

>> help symsolvesimul
solves a system (a pair) of non-linear or linear equations or a mixture,
returning a n x 2 column solution vector for x and y. The first parameter
is a row vector (1 x 4) of exponents used in both equations. An exponent
of one for both terms indicates a linear equation. The second parameter
(1 x 6) is also a row vector of all the coefficients and the constants
used in both equations. The order of both vector's elements is critical.
Note that there may be more than 1 solution for x and y (sometimes
complex)
and that they are presented in a symbolic format at times rather than a
pure numeric format.

USAGE: symsolvesimul([ex1 ex2 ex3 ex4],[a b a1 b1 c1 c2])
a*x^ex1 + b*y^ex2 = c1 (1)
a1*x^ex3^2 + b1*y^ex4 = c2 (2)
i.e.
>> z=symsolvesimul([1 1 2 2],[2 3 4 5 8 24]);

2 x + 3 y = 8

2 2
4 x + 5 y = 24

>> z

z =

[ 1, 2]
[ 13/7, 10/7]

These are the solutions for the 2 equations i.e. x = 1, y=2,
x=13/7, y = 10/7.
----------------------------------------------------------------
The code I wrote for 'solvesimul' is attached. Save it to your working folder and run as above.

Citation pour cette source

Bruce Raine (2026). Solving non-linear (and linear) simultaneous equations with 'solve' (https://fr.mathworks.com/matlabcentral/fileexchange/26293-solving-non-linear-and-linear-simultaneous-equations-with-solve), MATLAB Central File Exchange. Extrait(e) le .

Informations générales

Compatibilité avec les versions de MATLAB

  • Compatible avec toutes les versions

Plateformes compatibles

  • Windows
  • macOS
  • Linux
Version Publié le Notes de version Action
1.0.0.0