function f = economics_pde_fokker(y,t,alpha,C) % copy of Amit's burgersa.f code to numerically evaluate the Burgers % equation for the dimension-reduced variable. % Initialise parameters and number of points to integrate over numerically T = 10; L = 1000; dt = 0.01; dx = 1.0; dy = 1.0; f = exp(-1./(1:L));%rand(1,10000); Lx = L/dx; Ly = L/dy; nt = T/dt; % loop multiple times to improve accuracy for j = 1:nt % initialise derivatives for i = 2:Lx-1 delf(i) = (f(i+1)-f(i-1))./(2*dx); delsqf(i) = (f(i+1)+f(i-1)-2*f(i))/(dx*dx); end % initialise periodic boundary conditions delf(1) = (f(2)-f(Ly))/2*dx; delf(Lx) = (f(1)-f(Ly-1))/2*dx; delsqf(1) = (f(2)+f(Ly)-2*f(1))/(dx*dx); delsqf(Lx) = (f(1)+f(Ly-1)-2*f(Lx))/(dx*dx); % fixed end points f(1) = 0; f(Lx) = 0; % solve equation now ftot = 0; for k = 1:Lx hx = 0.01; f(k) = f(k) + dt*delsqf(k) + dt*(alpha+3 - C*exp(-k))*delf(k) + dt*(alpha+2)*f(k); ftot = ftot+f(k); end end f = f./ftot; end