Solving Viscous Burgers using spectral method

Change $u u_x$ to $(u^2/2)_x$. The Fourier transform of this term is $i k F(u^2/2)$. That is you apply fft directly to $u^2/2$, this is how you handle nonlinear terms in spectral method - there is really no trick. Below is what I wrote in matlab (use the simplest Euler forward step, so mind the time step size), it solves $x$ in $[0, 2\pi]$ with initial condition $\sin(x)$, but should be easy to adapt to your case.

N = 128;
h = 2*pi/N;
x = (0:N-1)*h;
dt  = 0.01;
D = 0.01;

k = [0:N/2-1 0 -N/2+1:-1]*2*pi/(2*pi);
k1 = 1i*k;
k2 = k1.^2;
%%
uinit = sin(x);
u0 = uinit;

for t = 0:dt:5.0
    u1hat = fft(u0) - dt*k1.*fft(0.5*u0.^2) + dt*D*k2.*fft(u0);
    u0 = ifft(u1hat);

    plot(x,uinit,x,u0)
    axis([0,2*pi,-1,1])
    title(num2str(t))
    pause(0.01);
end

Press F5 and enjoy. An example output at $t=5$ is: spectral method