LINCOEFFS: Matrix coefficients of symbolic linear equations

This function extracts the coefficient matrix and the column vector containing the non-homogeneous terms of a system of linear equations.
ダウンロード: 10
更新 2023/4/11

lincoeffs

MATLAB code to extract the coefficients of symbolic linear equations.

This function extracts the coefficient matrix and the column vector containing the non-homogeneous terms of a system of linear equations.

Syntax

[A,b] = lincoeffs(equations,variables), where equations is a column vector of symbolic equations containing left and right sides separated by the == operator, and variables is a column vector containing symbolic variables. The output arguments, A and b, allow us to rewrite the equations in the matrix form A*x==b.

Examples

syms m n
[A,b] = lincoeffs([3*m+10*n==0;m-n==4],[m,n])
rref([A,b])  % reduced row echelon form (Gauss-Jordan)

syms x [3,1]
equations = [5*x(1)-2*x(2)+x(3)==7
  x(1)+x(2)+x(3)==0
  2*x(1)+8*x(2)-x(3)==6];
[A,b] = lincoeffs(equations,x)
x = A\b   % solve the matrix equation
A*x == b  % test the solution

Requires

Symbolic Math Toolbox

License

===================================================================
The BeerWare License (Revision 69):
-------------------------------------------------------------------
<I. Santos-Ruiz> wrote this file. As long as you retain this notice
you can do whatever you want with this stuff.
If we meet some day, and you think this stuff is worth it,
you can buy me a beer in return.
===================================================================

View LINCOEFFS: Matrix coefficients of symbolic linear equations on File Exchange

引用

Ildeberto de los Santos Ruiz (2024). LINCOEFFS: Matrix coefficients of symbolic linear equations (https://github.com/isantosruiz/lincoeffs/releases/tag/1.0), GitHub. 取得済み .

MATLAB リリースの互換性
作成: R2023a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0

この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。
この GitHub アドオンでの問題を表示または報告するには、GitHub リポジトリにアクセスしてください。