Normalizing an FFT Vector
显示 更早的评论
Hey all,
I am currently trying to understand how exactly to normalize an fft eigenstate in the context of the 1-d particle in an infinite well. My code is as below:
L = 100;
x = linspace(0,L,L+1);
psi = sqrt(2/L)*sin(pi*x/L); %particle in a box ground state%
norm = trapz(x,psi.*conj(psi)); %normalized state has L-2 norm = 1%
F_T = fft(psi);
norm2 = trapz(2*pi*x/L, F_T.*conj(F_T));
The psi is the discretized array for my particle in position space that, as calculated in "norm", has L-2 norm of 1. Now I wanted to transform this into momentum space via the fft, but when I try to get the L-2 norm of it again as in "norm2", the norm is no longer 1. I have seen suggestions of dividing the fft by
online but it doesn't seem to resolve the issue either. Any advice would be appreciated.
Thanks!
采纳的回答
更多回答(1 个)
Try with fftshift function ,
L = 100;
x = linspace(0,L,L+1);
psi = sqrt(2/L)*sin(pi*x/L); %particle in a box ground state%
%<<norm is standard builtin function in matlab
Norm = trapz(x,psi.*conj(psi)) %normalized state has L-2 norm = 1%
F_T = (fftshift(psi));
F_T = norm(F_T)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!







