# Finding coefficients and constant for multivariable linear equation.

6 ビュー (過去 30 日間)
Shelley 2013 年 4 月 25 日
Hello
I want to find the coefficients and constant for the equation: A*x_1 + B*x_2 + C*x_3 + D*x_4 + E = 0, using 4 given points that satisfies the equation.
How do you do this in Matlab? I tried using regress and only got the trivial solution A=B=C=D=E=0.

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

### 採用された回答

Shashank Prasanna 2013 年 4 月 26 日
Shelley, to find a non-trivial solution you have to find the null space of your data matrix.
You data matrix with a column of ones (for the intercept term E):
>> M = [[1,1,1,1; 2,3,2,2; 4,5,4,6; 0,1,3,4],[1;1;1;1]]
M =
1 1 1 1 1
2 3 2 2 1
4 5 4 6 1
0 1 3 4 1
Regress will give you the trivial solution that is zeros. Since M above is rank deficient there are a family of solutions. The non-trivial solution would be the null space which you can compute as follows:
>> null(M)
ans =
-0.3536
0.3536
-0.7071
0.3536
0.3536
##### 1 件のコメント表示 なし非表示 なし
Shelley 2013 年 4 月 26 日
Okay I got it now. Thank you very much

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

### その他の回答 (1 件)

bym 2013 年 4 月 25 日
You don't have enough points. 4 points < 5 unknowns
##### 1 件のコメント表示 なし非表示 なし
Shelley 2013 年 4 月 26 日
Okay I see. Then there must be some kind of constraint for the equation that makes it possible to find a uniqe solution. The points are: (1,1,1,1), (2,3,2,2), (4,5,4,6), (0,1,3,4) and the equation is for an affine space in R^4.
Anybody knows how to solve this?

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

### カテゴリ

Find more on Linear Algebra in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!