function y = rep(A,m,n) % REP y = rep(A,m,n) Replicates matrix A % Version of 4/21/96 % Replicates A, % m times vertically, % n times horizontally % Essentially the same as repmat in version 5.1, 5.2 [r,c] = size(A); R = [1:r]'; C = [1:c]'; v = R(:,ones(1,m)); w = C(:,ones(1,n)); y = A(v,w);