c = input('c ');g = input('g ');syms Lambda_nM = cell(c+1,1);a_t = min([1:c+1;repmat(c-g+1,1,c+1)]);for i = 1:c+1 v = zeros(1,c+2-i, 'sym'); v(1)= Lambda_n*i; MCell = repmat({diag(v)}, 1, a_t(i)); M{i} = blkdiag(MCell{:}); endB=blkdiag(M{:});
'c' will determine the size of blocks which I already explained to you that they will be in decreasing order. 'g' is basically used in a_t = ,min{j,c-g}. Here a_t determines how many time a block should be repeated. So upto c-g the order of block upper diagonal matrix will be (i+1,i) and from c-g+1 upto c+1 it will be (c-g+1,c-g+1).
This is for the main diagonal block matrix which is shown in the picture. Similarly I want to create the upper diagonal as shown by the red line in the picture. I have tried to creat it using kron function but it was just not what i wanted. Kindly help me with this.
Best Answer