MATLAB: How to create matrix X matrix 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. Best Answer 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(:); Related SolutionsMATLAB: Sum of cell array columns Using cellfun, it is a one-liner.XX % 7x50 cell arrayXX_new = cellfun(@(x) {sum(x,2)}, XX); Related Question
Best Answer