Matlab code

Parent Previous Next

function [I] =  f3_cscb_ff(q,scaling,F_scal,F_cont_core,F_cont_shell,F_rad_core, ...

                               F_sigma,F_thick_shell,F_height,S_phi,model)

global glob

glob.H=F_height;

glob.R=F_rad_core;

glob.T=F_thick_shell;

glob.sigma=F_sigma;

glob.rhoshell=F_cont_shell;

glob.rhosolv=0;

glob.rhocore=F_cont_core;

glob.model=model;

h = waitbar(0,'Please wait...');

for z=1:max(size(q))

   waitbar(z/max(size(q)))

   glob.q=q(z);    

   accuracy=1e-12;

   F(z)=0;

   numsteps=300;

   for alpha=pi/100:pi/numsteps:pi/2

       glob.alpha=alpha;

       FF= scaling.*F_scal.*S_phi.*quad(@integrandCSM2cb,max([F_thick_shell-3*F_sigma*F_thick_shell 0]),F_thick_shell+3*F_sigma*F_thick_shell,accuracy);

       F(z)=F(z)+FF;

   end

   F(z)=F(z)/size([pi/100:pi/numsteps:pi/2],2);

end

close(h);

%-------------------------------------------------------------------

function P=integrandCSM2cb(T)

   global glob

   q=glob.q;

   H=glob.H;

   R=glob.R;

   rhosolv=glob.rhosolv;

   rhoshell=glob.rhoshell;

   rhocore=glob.rhocore;

   sigma=glob.sigma;

   TM=glob.T;

   capping=glob.model;

   alpha=glob.alpha;    

   V=pi.*(R+T).^2.0*(2.0.*H+2.0*T.*capping);

   Vc =pi*R.^2.0.*2.0.*H;

   P=weight(T,sigma,TM) .* ...

     ((2.0.*(rhocore-rhoshell).*Vc.*sin(q.*H.*cos(alpha))./(q.*H.*cos(alpha)).*besselj(1,q.*R.*sin(alpha))./(q.*R.*sin(alpha))+ ...

       2.0.*(rhoshell-rhosolv).*V .*sin(q.*(H+T.*capping).*cos(alpha))./(q.*(H+T.*capping).*cos(alpha)).*besselj(1,q.*(R+T).*sin(alpha))./(q.*(R+T).*sin(alpha))).^2.0.*sin(alpha)./V);

%--------------------------------------------------------------------