I am trying to understand how the MATLAB FFT normalization works.
Lets discuss the following example.
%%
sum2D = @(a) sum(reshape(a,1,[])); % sum elements in 2D matrix
a = [0 0 0; 1 2 1; 1 1 1; 1 1 1; 0 0 0]
f1 = fft2(a)
m = [0 32 0; 0 0 0; 0 1 0; 0 2 0; 0 0 0]
fs = m.*fftshift(f1);
fs = fs./sqrt(numel(fs));
fm = ifft2(fs);
fm = fm.*sqrt(numel(fm))
% imshow(abs(fs))
norm(a(:))^2,norm(fs(:))^2,norm(fm(:))^2
sum2D(abs(a).^2)
sum2D(abs(fs).^2)
sum2D(abs(fm).^2)
sum2D(abs(fp).^2)
If the m = 1, the normalization works and the energy is the same in the initial signal, fft and inverse fft. But if I multiply the signal after making fft by some vector m, then I don't know how to normalize this again.
Should the energy change after multiplying with the m, or I am doing something wrong.