MATLAB: Creation of matrix for looplow triangular matrix Hi. I have 2 matrices A(24,1) and B(24,1), and i want to create the matrix C(24,144), using the elements of A and B as follows (you can use lower triangular matrix and the For loop): Thanks Best Answer A=1:24;B=A*10;C=zeros(24,144);p=0;for k=1:6:144 p=p+1; C(p:end,k)=A(p); C(p:end,k+1)=B(p);endC Related SolutionsMATLAB: Creation of a matrix (24,72) with unit lower triangular matrix M5 = kron( tril(ones(24)),[1,0,0] ) MATLAB: Creation of matrices (24,72) M1&M2 You can use blkdiag:C1 = repmat({[1,1,0]},1,24);M1 = blkdiag(C1{:});And the second is either:M2 = circshift(M1,[0,1]);orC2 = repmat({[0,1,1]},1,24);M2 = blkdiag(C2{:}); Related QuestionCreation of matrix where the submatrices are resultants of smaller matrix multiplicationHow to multiply two matrices togetherHow to aggregate data based on values in a vectorHow to make a loop that would help me with the codeCombine two matrices into one
Best Answer