function MoutZ = depredikcija(g, height, width, N);



korak = 0;
for k = 1:N
    for i = 1:width
        for j = 1:height
            MoutZ(j,i,k) = g(korak + j,1);
        end
        korak = korak + height;
    end
end

%depredikcija
for x = 1:width
    for y = 1:height
        for z = 1:N
            
            if(z == 1)
                MdY(x, y, z) = MoutZ(x, y, z);
            else
                MdY(x, y, z) = MoutZ(x, y, z) + MdY(x, y, z-1);
            end
            
            if(y == 1)
                MdX(x, y, z) = MdY(x, y, z);
            else
                MdX(x, y, z) = MdY(x, y, z) + MdX(x, y-1, z);
            end
            
            if(x == 1)
                MdZ(x, y, z) = MdX(x, y, z);
            else
                MdZ(x, y, z) = MdX(x, y, z) + MdZ(x-1, y, z);
            end
            
        end
    end
end