how to create matrix X

2 vues (au cours des 30 derniers jours)
Don Singh
Don Singh le 26 Oct 2015
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.

Réponse acceptée

Star Strider
Star Strider le 26 Oct 2015
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(:);

Plus de réponses (0)

Catégories

En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by