clear all; close all;
fs=18; lw=1;

Nx = 10; Ny = 10;
xl = linspace(0,1,Nx+1);
yl = linspace(0,1,Ny+1);
xp = linspace((xl(1)+xl(2))/2,(xl(end-1)+xl(end))/2,Nx);
yp = linspace((yl(1)+yl(2))/2,(yl(end-1)+yl(end))/2,Ny);

for i=1:Nx
    for j=1:Ny
        w(i,j) = (2*(i+j-1))/(Nx*Ny*(Nx+Ny));
    end
end

figure(1); clf; hold on; grid on; axis tight;
view(-45,30);
set(gcf,'Position',[100 100 600 380]);
b = bar3(w);
colormap(gray);
for i = 1:Nx
    zdata = [];
    for j = 1:Ny
        zdata = [zdata; ones(6,4)*w(i,j)];
    end
    set(b(i),'Cdata',zdata);
end

ax=gca;
ax.TickLabelInterpreter = 'latex';
ax.FontSize = fs;
xticks(1:Nx);
yticks(1:Ny);

print(figure(1),'Schematic45','-dpng')