Newer
Older
%% Solve Fokker Planck equation
T = Ternary_model(0, 'Gauss', [-1, 0.043, 0.05, 0.4, 0.16, 0.2],...
linspace(0.0, 400, 5000));
T.t = 0:0.01:20;
T.solve_tern_frap()

Lars Hubatsch
committed
%% Frank's solution to the transfer/rate problem via Laplace transform

Lars Hubatsch
committed
x0 = 2;
D_m = T.g0(1)*(1-T.u0-T.e); % to make equal to ternary FRAP
D_p = T.g0(end)*(1-T.u0);

Lars Hubatsch
committed
ga = 1/9;

Lars Hubatsch
committed
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);

Lars Hubatsch
committed
%% Plot with full ternary model

Lars Hubatsch
committed
figure(2); hold on; cla;
j = i+2;
plot(x_left, p_in(D_p, D_m, ga, x0, x_left, j/100));
plot(x_right, p_out(D_p, D_m, ga, x0, x_right, j/100));
plot(T.x+T.a, T.sol(i, :), 'LineWidth', 2);

Lars Hubatsch
committed
axis([-1, 3, 0, 0.7]);

Lars Hubatsch
committed
shg; pause();

Lars Hubatsch
committed
end
%%
figure(3); hold on; cla;
plot(x_left, p_in(D_p, D_m, ga, x0, x_left, j/100), 'LineWidth', 2);
plot(x_right, p_out(D_p, D_m, ga, x0, x_right, j/100), 'LineWidth', 2);
plot(T.x+T.a, T.sol(i, :), 'LineWidth', 2);
axis([-1, 3, 0, 0.7]);