Hello,
I have a problem, I'd like to modulate the phase of the middle part of the Fourier plan (2D). If I don't modulate it, just calculate the input and the output volume, they will be the same. But if I shift the phase, for example add Pi to the middle part of the Fourier, the output will be greater than the input, and the problem is that it is physically not possible...
Part of my code:
energy_in=trapz(trapz(function))
ff=fft2(function,1024,1024);
ff2=fftshift(ff);
re=real(ff2);
im=imag(ff2);
amp=sqrt(re.^2+im.^2);%abs(ff2) is the same
phi=atan2(im,re); %angle(ff2) is the same, real
f_mod=faz_mod(half_side,8, 3.14 ,phi)
x=0;
y=0;
for i = -half_side:half_side-1
x=x+1;
for j = -half_side:half_side-1
y=y+1;
if ((((i*i)+(j*j)))<(r*r))
phi2(x,y)=phi(x,y)+phase;
else
phi2(x,y)=phi(x,y);
end
end;
y=0;
end;
a_mod=amp_mod(old_fele,8, 1 ,amp);
....
ff=a_mod.*exp(f_mod.*i);
iff=ifft2(ff,1024,1024);
volume=trapz(trapz(abs(iff)))
Can anybody help me, what's wrong with it?
|