how to create matrix X

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by