I have two matrices A and B containing values ββfor a checkerboard / chessboard grid shape
AxAxAxAx... xBxBxBxB... AxAxAxAx... xBxBxBxB... ........... ...........
Where x represents values ββthat are not yet known that I want to (linearly) interpolate. What is the easiest way to achieve this?
First of all, itβs possible
C = zeros(size(A)+size(B)); C(1:2:end,1:2:end) = A; C(2:2:end,2:2:end) = B;
to get the above matrix. Now I could iterate over all the remaining points and take the average of all direct neighbors, since 1) for loops in matlab are slow and 2) there, of course, there is a way to use interp2 , although this seems to require a meshgrid like mesh. So, can this be done easier / faster?
source share