How to setup system of linear equations in matrix form?

14 ビュー (過去 30 日間)
Giovanni Virgen
Giovanni Virgen 2018 年 6 月 30 日
回答済み: Walter Roberson 2018 年 6 月 30 日
I have a system of four linear equations that I need to put into matrix form. Equations are in the form of:
5x1+4x2-2x3+6x4=4
3x1+6x2+6x3+4.5x4=10 etc.

回答 (2 件)

Ameer Hamza
Ameer Hamza 2018 年 6 月 30 日
You can do it by making a matrix A of coefficients and a matrix b of the number on right side of the equations.
A = [column_of_coefficients_of_x1, column_of_coefficients_of_x2, ... column_of_coefficients_of_xn];
b = [column_of_values on RHS of the equations];
For the equations, you gave in the question,
A = [5 4 -2 6; ...
3 6 6 4.5];
b = [4; ...
10];
You can then solve the system using
A\b

Walter Roberson
Walter Roberson 2018 年 6 月 30 日

カテゴリ

Help Center および File ExchangeSystems Of Linear Equations についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by