フィルターのクリア

Solve linear equation with added constant

4 ビュー (過去 30 日間)
Gordon Edwards
Gordon Edwards 2019 年 2 月 13 日
編集済み: Cam Salzberger 2019 年 2 月 13 日
I wish to solve the matrix equation Ax = B + C for x and C. A is a known n-by-m matrix, B is a known n-by-1 vector, C is an unknown scalar and n > m+1 i.e. the equation is over-determined. I can't seem to put the equation into a form where the MatLab linear equation functions are useful. Any ideas?

採用された回答

Cam Salzberger
Cam Salzberger 2019 年 2 月 13 日
編集済み: Cam Salzberger 2019 年 2 月 13 日
Hello Gordon,
Since C is unknown, and a scalar, you could simply consider it to be an extension of the unknowns of x. So instead of x being an m-by-1 vector of unknowns, it's now an (m+1)-by-1 vector of unknowns, which still works since the system is overdetermined, as you said. So you can reformat your A matrix to have an added -1 to the end (for the coefficient to C), and simply solve the normal way:
[n, m] = size(A);
A_new = [A -ones(n, 1)];
x = A_new\B;
x_original = x(1:m);
C = x(end);
Hope that helps!
-Cam

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by