how to create matrix X
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Don Singh
am 26 Okt. 2015
Beantwortet: Star Strider
am 26 Okt. 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.

0 Kommentare
Akzeptierte Antwort
Star Strider
am 26 Okt. 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(:);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!