# Scaling factor of the inverse Fourier Transform (for convolution purposes)

I have a certain 2-D function. More properly, I have not the function itself, but the matrices $[X,Y,Z]$, where $X,Y$ are $1\times n$, and $Z$ is $n \times n$.

Now, I want to calculate a a new matrix, $\hat Z$, whose value at each point is the average of $Z$-values from a small region around that point. In other words, $\hat Z(p) = \frac{\int_{B(p,r)} Z(x,y)dxdy}{\pi r^2}$ for some small fixed $r$.

The way I have decide to do this is via convolution with a $\delta$ -like function, and thus via multiplication of the respected FFT transforms.

I find the FFT of $Z$, as well as the FFT of a cylinder with base $B(0,r)$, and volume $1$. Then I take the product of the FFT transforms, and then take the absolute value of the inverse transform to be $\hat Z$.

Visually, the result looks correct, i.e. when plotting $\hat Z$ it does look like the original, only more "smoothed-out". When I increase $r$, the result becomes further flatter and flatter.

But the are some scaling issues, by which I mean that the scaling of the end result is completely off (orders of magnitude), whereas for small $r$ I expect the range to be roughly the same. I suspect that to be a known issue with the FFT transform, but I do not manage to find the proper scaling factor.

You have to normalize by the number of elements in the FFT. That is if the size of your matrix is $(NxM)$ you must normalize your FFT by $(NxM)$. You can check this is valid by looking at the energy content of the two matrices.
• Also, it seems that matlab routines already perform some scaling. For instance, ifft2(fft2(z)) returns the matrix z itself, no scaling needed. However, it seems what I needed to do was making the cylinder (actually, a box in my case) of height $1$, and the normalizing it by the amount of non-zero elements. – Aahz Nov 11 '14 at 7:33
• Yes, so apparrently I need to scale the $\delta$ function somehow. Currently I choose the height to be the number of non-zero points, and it seems to work (though I am not sure entirely). If I go by "volume = 1", the scaling is way off. – Aahz Nov 11 '14 at 9:15