Fourier Transform: Inverse FFT of Positive Definite Power Spectrum Not Giving Positive Definite Function
6 views (last 30 days)
Show older comments
Hello there,
I am attempting to write a Fourier transform "round trip" in 2D to obtain a real, positive definite covariance function. This is the following workflow:
- Calculate covariance map. This map will be symmetric but it will NOT have all positive values.
- Take the FFT of the covariance. This will give a power spectrum that is REAL, but NOT positive definite because the covariance is real but not positive definite.
- Do some smoothing on the power spectrum so that all values are either positive or zero. This power spectrum is now positive definite and symmetric.
- Take the IFFT of the smoothed, positive definite, real power spectrum. This should give a back-transformed, positive definite, real covariance map.
The purpose of this work is to apply Bochner's theorem, which states that a function positive in the frequency domain should be positive definite in the spatial domain. However, after making all power spectrum values either positive or zero, the back-transformed Covariance map is NOT positive definite, as it still has some negative values. Why is this the case? By ensuring that all power spectrum values are real and non-negative, shouldn't the back-transformed Covariance also be real and non-negative?
Here is my round-trip code. h1 and h2 are the x and y lags, Cov is the input covariance, and k is the degree of nxn smoothing on the spectrum (need not focus on s and countpairs, as they are for sparse data).
function [Cov,CovIFFT,fomega,fomega_s,fomega_ss] = FFT2D(h1,h2,Cov,k,s,countpairs) %k is degree of smoothing, h1 is x lags, h2 is y lags (enter -h:h)
if s==1 %if sparse data, smooth covariances first
[X_smoothing, Y_smoothing] = meshgrid(h1,h2);
Cov = SmoothingCovNaN(Cov,countpairs,X_smoothing,Y_smoothing,0.1);
end
Cov_shift=ifftshift(Cov); %shift coordinates so FFT is real
fomega_unshifted=fft2(Cov_shift); %take FFT
fomega_unshifted_real=real(fomega_unshifted); %remove negligible imaginary component
fomega=fftshift(fomega_unshifted_real); %shift FFT to center; this is the data we will do post-processing on
%SCHEME 1: WINDOW SMOOTHING, SET NEGATIVE VALUES TO 0
% if k==0 %dont perform smoothing if k==0
% fomega_s=fomega;
% else
% fomega_s=SmoothingMovingAverage(fomega,k); %kxk window smoothing
% end
%SCHEME 2: SHIFT ALL VALUES BY MIN SO SMALLEST VALUE IS 0
[fomega_s]=NoNegShift(fomega);
[fomega_ss] = SmoothingSum1DS(fomega_s,h1,h2); %exponential standardize to 1 smoothing
% fomega_s=fomega; %REMOVE -- JUST FOR TESTING PURPOSES
% fomega_ss=fomega_s; %REMOVE -- JUST FOR TESTING PURPOSES
fomega_ss_unshifted=ifftshift(fomega_ss); %go back to unshifted image after post-processing to ensure IFFT is real
CovIFFT_unshifted=ifft2(fomega_ss_unshifted); %back transform unshifted image to get real covariance result
CovIFFT=real(fftshift(CovIFFT_unshifted)); %now that unshifted image has undergone IFFT, shift it back. This is the final output! (okay to take real because imaginary component is small)
end
Here are some example result figures:
1. Covariance map
2. Density spectrum (unsmoothed, not positive definite)
3. Smoothed density spectrum (positive definite, done by shifting all values by minimum value)
4. Smoothed density spectrum (positive definite, unit sum)
5. Back-transformed covariance map (SHOULD be positive definite because smoothed density spectrum is positive definite, but is not!)
Any help would be dearly appreciated. Thank you!
Corey
7 Comments
David Goodmanson
on 17 Mar 2020
Edited: David Goodmanson
on 17 Mar 2020
Hi Corey, I agree that this kind of symmetry, A = A + fliplr(flipud(A)), does give a real result.
Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering 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!