From: Peter Pan on
Hi, i try to get the prob density out of a (general) characteristic function via fourier inversion. I wrote something (see below). However, if I test it with the multivariate normal, the form is correct but the center is at a wrong point... hence, something is wrong! Any hints?

Thanks a lot...
c

N=2^nextpow2(1e3); %number of samples
dx=.1; %x axis sampling interval
dy=dx;
dfx=1/N/dx; % f-axis sampling interval
dfy=1/N/dy;

%set up axes
Axis=( -ceil((N-1)/2):N-1-ceil((N-1)/2) );
[xAx,yAx]=meshgrid(dx*Ax,dy*Ax);
[xfAx,yfAx]=meshgrid(dfx*Ax,dfy*Ax);

y=exp(-i*5*xAx-1/2*xAx.^2-1/2*yAx.^2);
y=ifftshift(y);
f=abs(ifftn(y)); f=ifftshift(f);

h=surf(xfAx,yfAx,f);
set(h,'EdgeColor','none')
xlim([-2,2])
ylim([-2,2])