Does fft still work if I remove the zero?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all, I am encountering some problems with regards to fft. I'm currently doing a physics project and it requires me to multiply a function say f(r) with a phase factor exp(1i.*V(r)) where V(r) is a potential which would go to infinity at r=0 and then lastly followed by a fft/ifft. I have no choice but to remove the 0 in my array of columns for the space (which is x and y as I later on define my r = sqrt(x.^2+y.^2)). I am wondering if I would still need the fftshift/ifftshift if my columns of x and y do not even have 0 in them? Or if I actually need the 0 for fft to work? I shall include my codes to make myself clearer..
%space parameters, this is how I define my x and y, and r eventually
lower = -5;
upper = 5;
fq = 10;
x = (lower:1/fq:upper)';
y = (lower:1/fq:upper)';
L = length(x);
if mod(L,2)==1
x((L+1)/2)=[];
y((L+1)/2)=[];
L = length(x);
pr = fq*(1:(L/2))/(L/2)*pi;
pl = -fliplr(pr);
p = [pl pr];
end
px = transpose(p); %columns
py = p; %rows
r = sqrt(x.^2+y'.^2); %x as columns y as rows
phi = atan2(y',x);
[xx,yy] = meshgrid(x,y);
[Px,Py] = meshgrid(px,py);
V = V = r.^2 + r.^(-2);
%this is a small section of my fft codes:
for t1= 0:dt:timef
test = iw.*exp(-1i/6.*V.*dt); %position space
test = fftshift(fft2(ifftshift(test)));%x->p
end
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!