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

버전 1.0.0.0 (1.74 KB) 작성자: Bruce Raine
symsolvesimulv2.m solves non-linear and linear (or a mix of) simultaneous equations.
다운로드 수: 702
업데이트 날짜: 2010/1/8

라이선스 보기

symsolvesimulv2.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).

Big change: It now has data input integrity checking.

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

>> help symsolvesimulv2
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: symsolvesimulv2([ex1 ex2 ex3 ex4],[a b a1 b1 c1 c2])
a*x^ex1 + b*y^ex2 = c1 (1)
a1*x^ex3 + b1*y^ex4 = c2 (2)
i.e.
>> z=symsolvesimulv2([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 'solvesimulv2' is attached. Save it to your working folder and run as above.

인용 양식

Bruce Raine (2024). Solving non-linear (and linear) simultaneous equations with 'solve' - version 2 (https://www.mathworks.com/matlabcentral/fileexchange/26313-solving-non-linear-and-linear-simultaneous-equations-with-solve-version-2), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0