Skip to content

Instantly share code, notes, and snippets.

@jdherman
Created November 2, 2013 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdherman/7282813 to your computer and use it in GitHub Desktop.
Save jdherman/7282813 to your computer and use it in GitHub Desktop.
C(x,y,t) for diffusion 2D
function [C] = C_analytical(x,y,t)
mdot = 1; % kg/s
D = 10^-3;
L = 1;
outer_term = mdot./(4*pi*t*sqrt(D*D));
exp_sum = 0;
for m = -20:20
for n = -20:20
term1 = -(x+n*L).^2./(4*D*t);
term2 = -(y+m*L).^2./(4*D*t);
exp_sum = exp_sum + exp(term1 + term2);
end
end
C = outer_term.*exp_sum;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment