- If A is a scalar, then A\B is equivalent to A.\B.
- If A is a square n-by-n matrix and B is a matrix with n rows, then x = A\B is a solution to the equation A*x = B, if it exists.
- If A is a rectangular m-by-n matrix with m ~= n, and B is a matrix with m rows, then A\B returns a least-squares solution to the system of equations A*x= B.
Simultaneous Equation using reduced row method
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, I am new to the software and am wondering how you would write a code which would solve any number of simultaneous equations. ie a code that when 3 equations were inputted would work out the answers as well as if you inputted 10 equations
0 件のコメント
採用された回答
Image Analyst
2020 年 11 月 3 日
Put the coefficients into a matrix, then divide.
Syntax
Description
x = A\B solves the system of linear equations A*x = B. The matrices A and B must have the same number of rows. MATLAB® displays a warning message if A is badly scaled or nearly singular, but performs the calculation regardless.
Example:
% 2x + 4y + 3z = 3
% 3x + 5y + 2z = 8
% 1x + 2y + 5z = 9
A = [2,4,3; 3,5,2; 1,2,5]
B = [3;8;9]
xyz = A\B
% Other example from the help
A = magic(3)
B = [15; 15; 15];
x = A\B
If you still need help, give us your set of equations.
6 件のコメント
Image Analyst
2020 年 11 月 3 日
My pleasure. To thank people in the forum, you can award them "reputation points" by "Accepting" their answer and also clicking on the "Vote" icon. Thanks in advance.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!