How can I solve the linear system of equations with Matlab?

3 ビュー (過去 30 日間)
Nghia
Nghia 2014 年 1 月 4 日
回答済み: Roger Stafford 2014 年 1 月 4 日
Hi everyone, I want to find a function to solve the linear system of equations n Matlab. For example, let's focus on this system of equations: x1+x2+2x3=0 x1+2x2-x3=0
Suppose that the answer is: x1=-a, x2=5a, x3=a. I want Matlab to show [-1 5 1]'
How can I do that? Please help me. Your help will be really appreciated. Thank you.

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 4 日
a=1;
x1=-a,
x2=5a,
x3=a
sol=[x1 x2 x3]
  2 件のコメント
Nghia
Nghia 2014 年 1 月 4 日
But I want when I enter the system of equation, it will show the [-1 5 1].
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 4 日
I don't understand what you want. Please reformulate your question and make it clear

サインインしてコメントする。


Roger Stafford
Roger Stafford 2014 年 1 月 4 日
If your equations are homogeneous as in your example, you need to use matlab's 'null' function. See its documentation at:
http://www.mathworks.com/help/matlab/ref/null.html
In your example its solution would be
Z = null([1 1 2;1 2 -1]);
and the column vector Z would only be proportional to [-1 5 1] since it will have a norm of one.

カテゴリ

Help Center および File ExchangeMatrix Computations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by