% m39chebfun - Chebfun Fisher-KPP alternative using "spin" % u_t = .01*u_xx + u - u^2, u(0)=1, u(L)=0 (nonlinear). L = 50; d = [-L L]; tmax = 40; S = spinop(d,[0 tmax]); S.lin = @(u) .01*diff(u,2); S.nonlin = @(u) u - u.^2; S.init = chebfun(@(x) .5*(1+tanh(10*(cos(pi*x/L)-.7))),d,'trig'); npts = 256; dt = 0.01; pref = spinpref('Ylim',[-2 3]); spin(S,npts,dt,pref)