I'm trying to upsample a matrix by two by replicating another matrix, but i'm confused with the code, basically what i want is if:
Y = [1,2]
then the upsampled version would look like:
Up = [1,1,2,2;1,1,2,2]
What i've written so far is:
[row,col] = size(y)
Up = zeros(row*2,col*2);
for i = 1:2:row*2
for j = 1:2:col*2
Up(i, j) = Y(i,j);
Up(i+1, j) = Y(i,j);
Up(i, j+1) = Y(i,j);
Up(i+1, j+1) = Y(i,j);
end
end
but it says Index exceeds matrix dimensions, which i understand is because of the +1s but i'm not sure how else to go about doing this...