MATLAB: How to make a big tridiagonal matrix with matrices matrix manipulation How can I make a matrix H from two smaller matrices as shown in the attached image? Best Answer h=size(H0);a=[H0,zeros(h);zeros(h),H0];b=[zeros(h),H1;H1,zeros(h)];H=blkdiag(a,a,a,a,a,a)+blkdiag(b,b,b,b,b,b)+blkdiag(zeros(h),b,b,b,b,b,zeros(h)); Related SolutionsMATLAB: Replace values in matrix A based on values of matrix B A(B==0) = 0; MATLAB: Tridiagonal matrix TD = full(gallery('tridiag',100,0.99 , -2 , 2.01))EDIT Per Comment:y = TD\B; Related QuestionFor Loop with matricesHow to split one big matrix in several matricesMatrix dimensions must agree error for backslash.How to assemble matrices
Best Answer