Fourier Transform: Inverse FFT of Positive Definite Power Spectrum Not Giving Positive Definite Function

5 次查看(过去 30 天)
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:
  1. Calculate covariance map. This map will be symmetric but it will NOT have all positive values.
  2. 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.
  3. 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.
  4. 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 个评论
Corey Hoydic
Corey Hoydic 2020-3-17
编辑:Corey Hoydic 2020-3-17
Hello David,
Please see an example matrix for the symmetries. You can see that the result is indeed real
A =
0.5997 0.6909 0.7844 0.8178 0.7765
0.6854 0.7865 0.8904 0.8872 0.8089
0.7736 0.8854 1.0000 0.8854 0.7736
0.8089 0.8872 0.8904 0.7865 0.6854
0.7765 0.8178 0.7844 0.6909 0.5997
fft2(ifftshift(A))
ans =
19.7733 0.9676 0.0200 0.0200 0.9676
0.8892 0.7805 -0.1590 0.2828 -0.3881
0.0192 -0.1706 0.1510 -0.0676 0.2883
0.0192 0.2883 -0.0676 0.1510 -0.1706
0.8892 -0.3881 0.2828 -0.1590 0.7805f
fftshift(ans)
ans =
0.1510 -0.1706 0.0192 0.2883 -0.0676
-0.1590 0.7805 0.8892 -0.3881 0.2828
0.0200 0.9676 19.7733 0.9676 0.0200
0.2828 -0.3881 0.8892 0.7805 -0.1590
-0.0676 0.2883 0.0192 -0.1706 0.1510

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by