% m42chebfun - a Chebfun alternative using "spin" d = 32*pi*[-1,1]; tmax = 500; S = spinop(d,[0 tmax]); S.lin = @(u) -diff(u,2) - diff(u,4); S.nonlin = @(u) -.5*diff(u.^2); S.init = chebfun('cos(x/16).*(1+sin(x/16))',d,'trig'); pref = spinpref('Ylim',[-10 10]); npts = 256; dt = 0.02; spin(S,npts,dt,pref);