how to create matrix X

4 ビュー (過去 30 日間)
Don Singh
Don Singh 2015 年 10 月 26 日
回答済み: Star Strider 2015 年 10 月 26 日
I am trying to create a matrix X like in the attached image. I have the vectors x,y,z denoted as DE,DN,DZ respectively.

採用された回答

Star Strider
Star Strider 2015 年 10 月 26 日
That is straightforward, using the (:) addressing to create column vectors regardless of their original orientation:
X = [ones(size(DE(:))) DE(:) DN(:) DZ(:)];
If you also have your ‘g’ vector (all vectors must be the same length), calculate the ‘a’ coefficients as:
a = X\g(:);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by