% b = poisson3d_rhs(n)
%
% Compute a sample RHS for a Poisson problem on a regular mesh
% with n-by-n-by-n interior points.

function b = poisson3d_rhs(n);

x = linspace(0,1,n)';
b1 = x.*(1-x);
e = ones(n,1);
b = kron(kron(b1,e) + kron(e,b1), e) + kron(kron(e,e),b1);