How to apply ifft on characteristic functions

조회 수: 10 (최근 30일)
Ronald
Ronald 2014년 7월 4일
편집: Viktor Witkovsky 2018년 10월 25일
I have a characteristic function of a standard normal distribution function exp(-1/2ω^2) and want to use ifft to recover back to its original form in the real space. Imposing the Nyquist relation to the grid sizes in the x- and ω-domains, ∆x · ∆ω ≡ 2π/N is crucial here, but I messed up something in my codes. It would be great if you could teach how to do it.
Here are my codes:
%Real Space
x_min = -10.0; x_max = 10.0;
dx=(x_max-x_min)/(N-1);
x=x_min:dx:x_max;
% Fourier space
w_max=pi/dx;
dw=2*w_max/(N);
w=pi/x_max*x+pi;
w=[0:dw:w_max,-w_max+dw:dw:-dw];
char_exp_factor = exp((-0.5*(sigma*w).^2));
fftw('planner', 'measure');
pdf= real(ifft(char_exp_factor));
pdf doesn't look like a normal probability density function at all.

답변 (1개)

Viktor Witkovsky
Viktor Witkovsky 2018년 10월 25일
편집: Viktor Witkovsky 2018년 10월 25일
Try this alternative approach:
x_min = -10.0;
x_max = 10.0;
N = 2^8;
k = (0:(N-1))';
w = (0.5-N/2+k) * (2*pi / (x_max-x_min));
cffun = @(w) exp(-0.5*w.^2)
cf = cffun(w(N/2+1:end));
cf = [conj(cf(end:-1:1));cf];
dx = (x_max-x_min)/N;
C = (-1).^((1-1/N)*(x_min/dx+k))/(x_max-x_min);
D = (-1).^(-2*(x_min/(x_max-x_min))*k);
pdf = real(C.*fft(D.*cf));
cdf = cumsum(pdf*dx);
x = x_min + k * dx;
% PLOT of the PDF and CDF
figure;plot(x,pdf);grid
figure;plot(x,cdf);grid
For more details see cf2DistFFT in CharFunTool (The Characteristic Functions Toolbox), and the references:
  1. Hürlimann, W., 2013. Improved FFT approximations of probability functions based on modified quadrature rules. In International Mathematical Forum (Vol. 8, No. 17, pp. 829-840).
  2. Witkovský, V., 2016. Numerical inversion of a characteristic function: An alternative tool to form the probability distribution of output quantity in linear measurement models. Acta IMEKO, 5(3), pp.32-44.

카테고리

Help CenterFile Exchange에서 Discrete Fourier and Cosine Transforms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by