making coarse matrix from fine resolution matrix
26 views (last 30 days)
Hi, I am trying to make a coarse resolution matrix of 3600x1800 from a 8640x4320 matrix by summing up the elements of the matrix.
Hi am trying the following: However this doesnot work with fractions (here, 2.4)
%%%%Z1 is the original 8640x4320 matrix
abc = blockproc(Z1,[2.4,2.4],@(x)sum(x.data));
abc1 = blockproc(abc,[1,2.4],@(x)sum(x.data));
Edited: Matt J on 27 Jan 2020
A 3rd approach, more memory conserving and faster,.
u = 5; %upsampling factor
d = 12; %downsampling factor
t = d/u; %reduction factor
L=repelem(L2,1,d) * repelem(L1,u,1);
R=(repelem(R2,1,d) * repelem(R1,u,1)).';
Note as well that the matrices L and R are reusable on other Z1 of the same size that one might wish to downsample later on.