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);
    end
    C