%% Frank's solution to the transfer/rate problem via Laplace transform x0 = 1; D_p = 0.85; D_m = 0.15; ga = 1/10; p_out = @(D_p, D_m, ga, x0, x, t) 1./(2*sqrt(D_p*pi*t))*... (exp(-(x+x0).^2./(4*D_p*t))*(ga*sqrt(D_p)-sqrt(D_m))./... (ga*sqrt(D_p)+sqrt(D_m))+exp(-(x-x0).^2./(4*D_p*t))); p_in = @(D_p, D_m, ga, x0, x, t) 1./(sqrt(pi*t)*(sqrt(D_m)+ga*sqrt(D_p)))*... exp(-(x-x0*sqrt(D_m/D_p)).^2/(4*D_m*t)); x_left = linspace(-4, 0, 1000); x_right = linspace(0, 4, 1000); for i = 1:100 figure(1); hold on; cla; plot(x_left, p_in(D_p, D_m, ga, x0, x_left, i/10)); plot(x_right, p_out(D_p, D_m, ga, x0, x_right, i/10)); axis([-4, 4, 0, 2]); shg; pause(); end