function [R]=prof1Dto3Dcyl(r)

% 1D profile to 3D cylinder


m = 2*r+1; n = 2*r+1; p=2*r+1;
[px,py,pz] = meshgrid(1:n, 1:m, 1:p);
xc = r+1; yc = r+1; zc = r+1; % the center of sphere
R = sqrt((px-xc).^2 + (py-yc).^2 + (pz(:,:,zc)-zc).^2);
R  = R/(zc-1);
R(R>1)=0;


