Home > OS >  Create a matrix from a sub matrix?
Create a matrix from a sub matrix?

Time:11-09

I have a matrix of size N -by- N and I want to create a matrix (10 N) -by- (10 N), where each N -by- N block is a copy of the original matrix. I would like to do it without for loops.

I have tried with the function kron, but it only "enlarges" the original matrix.

How can I make this matrix?

CodePudding user response:

You're looking for repmat()

A = rand(10);  % Original 10 x 10 matrix
B = repmat(A, 10);  % Copied 10 times in each direction
  • Related