フィルターのクリア

Why I'm getting empty values for the unknowns [a0, a1, a2, b0, b1, b2] using solve function?

2 ビュー (過去 30 日間)
Abb
Abb 2023 年 5 月 17 日
コメント済み: Torsten 2023 年 5 月 17 日
I'm going to find the values for [a0, a1, a2, b0, b1, b2] by having 5 of knowns coordinates (u,v), (x_n,y_n)? why I'm getting empty values?
u = [73.430, 9.522, 491.183, 569.351, 577.275];
v = [730.723, 1311.200, 1286.046, 676.560, 1868.456];
x_n = [88, 26, 503, 577, 594];
y_n = [740, 1326, 1296, 688, 1872];
syms a0 a1 a2 b0 b1 b2
eqn1 = x_n - a0 + a1*u + a2*v==0;
eqn2 = y_n - b0 + b1*u + b2*v==0;
sol = solve([eqn1, eqn2], [a0, a1, a2, b0, b1, b2]);
  3 件のコメント
Abb
Abb 2023 年 5 月 17 日
編集済み: Abb 2023 年 5 月 17 日
@Torsten I have no idea about regression, but my goal is finding the unknown values. Just that. I have the values for u,v and x_n, y_n, and looking for other values.
Abb
Abb 2023 年 5 月 17 日
@Torsten I just updated the question with known values to help to repreduce the issue.

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

採用された回答

Torsten
Torsten 2023 年 5 月 17 日
編集済み: Torsten 2023 年 5 月 17 日
u = [73.430, 9.522, 491.183, 569.351, 577.275].';
v = [730.723, 1311.200, 1286.046, 676.560, 1868.456].';
x_n = [88, 26, 503, 577, 594].';
y_n = [740, 1326, 1296, 688, 1872].';
A = [-ones(5,1), u, v, zeros(5,1), zeros(5,1), zeros(5,1);zeros(5,1), zeros(5,1), zeros(5,1), -ones(5,1),u,v];
b = [-x_n;-y_n];
sol = A\b;
a0 = sol(1)
a0 = 9.1045
a1 = sol(2)
a1 = -0.9903
a2 = sol(3)
a2 = -0.0065
b0 = sol(4)
b0 = 16.1529
b1 = sol(5)
b1 = 0.0068
b2 = sol(6)
b2 = -0.9966
  2 件のコメント
Abb
Abb 2023 年 5 月 17 日
@Torsten Thanks alot, could you please write down the equation behind this code?
Torsten
Torsten 2023 年 5 月 17 日
- a0 + a1*u(i) + a2*v(i)=-x_n(i) (i=1,...,5)
- b0 + b1*u(i) + b2*v(i)=-y_n(i) (i=1,...,5)
Thus 10 equations in 6 unknowns. You cannot expect that all equations are satisfied with equality. The code above solves for the unknowns by minimizing
sum_{i=1}^{i=10} error(i)^2
with
error(i) = x_n(i) - a0 + a1*u(i) + a2*v(i) (i=1,...,5)
error(5+i) = y_n(i) - b0 + b1*u(i) + b2*v(i) (i=1,...,5)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by