How to apply ifft on characteristic functions

13 views (last 30 days)
Ronald
Ronald on 4 Jul 2014
Edited: Viktor Witkovsky on 25 Oct 2018
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.

Answers (1)

Viktor Witkovsky
Viktor Witkovsky on 25 Oct 2018
Edited: Viktor Witkovsky on 25 Oct 2018
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.

Tags

Community Treasure Hunt

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

Start Hunting!