Scaling Problem with IFFT after operating in the Fourier domain.
Show older comments
Hi all,
I've encountered a scaling problem when doing the IFFT.
In this code, the DFT a slope matirx of a surface function is used to reconstruct the function. A slew of operations are required in the Fourier domain before IDFT to get reconstructed surface matirx.
However, the resulting reconstructed surface is scaled by a factor. I am unable to determine any scaling standard that is suitable.
Here, the code in 1D is as follows:
%----Determination of Sampling period/space, Length of matrix etc.-------% dX = 0.64; % Sampling distance/period -mm L = 25; %Physical Length of Specimen -mm M =floor(L/dX); % Length of matrix x = (0:M)*dX; % space vector N = size(x,2); % vector size of x/phi df=1/(dX*N); % frequency q=0:M; % x/phi Matrix Coordinahtes (starting frm 0) %-------Surface function, slope matrix and FFTs------------------% phi=sin(x); % given surface function, phi - 1D Fphi=fft(phi); % DFT of phi [Sx]=gradient(phi,dX); % Slope matrix FSx=(fft(Sx)); % DFT of slope %----Operations to form IDFT of surface (in Fourier domain)------% phiup= ((exp(1i*-2*pi.*q./N)-1).*FSx ); phido=1./(2*((sin(pi.*q./N)).^2 )); phifi=phiup.*phido; phifi(1)=0; %eliminates infinite/NaN value %Make matrix conjugate symmetric% for k=2:floor(N/2) phifi(N-k+2)= real(phifi(k))-1i*imag(phifi(k));end %------IDFT,final reconstructed matrix--------% phiRe=(ifft(phifi)); %----------------PLOTS------------------- % figure; subplot(2,2,1);plot(x,real(phiRe),'r',x,phi,'b'); %8 title('Reconstructed phase, comparison'); subplot(2,2,2);plot(x,abs(phifi),'r',x,abs(Fphi),'b'); title('alpha/DFT phase (abs), comparison'); subplot(2,2,3);plot(x,real(phifi),'r',x,real(Fphi),'b'); %7 title('alpha/DFT phase (real), comparison'); subplot(2,2,4);plot(x,imag(phifi),'r',x ,imag(Fphi),'b'); title('alpha/DFT phase (imag), comparison');legend('Reconstructed','Actual'); The resultant plot gives phiRe with a scaling of around 3. However, I need to establish a standard for Scaling. How should i scale it correctly?
I need to understand this well as it will be applied for a 2D case too. THANKS!
Answers (0)
Categories
Find more on Fast Fourier Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!