function v_hat=fix_fft(u_hat,n)
% FIX_FFT orders fft properly and pads by zeros
% input n-vector, output (2n-1)-vector
v_hat = [zeros(1,(n/2)) u_hat((n/2+2):n) u_hat(1) ...
                        u_hat(2:(n/2)) zeros(1,n/2)];
end