Your last line is: u = real(ifft(u))
In that case you seem to be throwing away all the intermediate calculations. Should it be: u = real(ifft(uf)) ?
Your last line is: u = real(ifft(u))
In that case you seem to be throwing away all the intermediate calculations. Should it be: u = real(ifft(uf)) ?