Purpose of multiplying fft output by Hann window? I'm working with some acoustic propagation models at the moment.
A feature I've noticed in 2 of these models is that the output of the model is often multiplied by a Hann window in the frequency domain immediately before reporting the results in the time-domain.

I've been struggling to understand the idea behind this, as I'm only familiar with window functions applied in the time-domain.

To give some background... these models operate by (to my understanding):


Simulating a theoretical rectangular spectra (with equal phase values for all frequencies).
The models then calculate the loss per frequency as sound propagates through the environment.
Frequency domain and time domain plots are typically returned to view the results in an intuitive fashion (dB loss per frequency).


I am assuming that to convert this back into the time domain (to show the effects of spectral dispersion), the Hann window somehow makes this signal viewable, as otherwise the flat phase values would result in non-sensical time domain signals.


Can anyone briefly describe the DSP theory behind multiplying a flat (rectangle) spectra with a Hann window of the same size?


Below I have shown some relevant matlab code.
This piece of code (as I understand) frequency shifts the signal (phs), multiplies the frequency domain by a hann window (hanwin), then converts back into the time domain fft.
The resulting tlpressd is used to plot the dB propagation loss per time in the resulting plot.
The looping term just runs through all the output ranges of the environment.



hanwin=hanning(nf+1);
hanwin=fftshift(hanwin(1:nf)/sum(hanwin(1:nf)));
phs=2*pi*cfreq*time;
if optout == 1
  for irng=1:nrout,
    pressd(irng,:)=fftshift(fft(pressd(irng,:).*hanwin')).*exp(-j*phs);
    timeout(irng,:)=time+rngout(1,irng)/(c0/1000.);
  end
% pressd = complex pressure field, row = range; col = time
tlpressd=-20*log10(max(abs(pressd),1.e-20));


Notes

FYI, the code above is from Kevin Smith's "Monterey-Miami Parabolic Equation" propagation model.  It converts the resulting green's function solutionsof the model into a one of several visual representations (time vs Frequency, or Frequency vs Depth ,etc)

To give more context (and possibly more confusion).  If I replace the variable hanwin with any time-domain signal of my choice, the end of the code block provides be with the convolution of that signal with the propagation effects the model calculated (i.e. it simulates the effects of propagation on the provided signal).  Its clear that I'm convolving the Hann window with my model output... but I have no idea what the signal theory behind this is.
Can anyone briefly describe the DSP theory behind multiplying a flat (rectangle) spectra with a Hann window of the same size?


Without any reference to the actual model and its purpose, the only thing one can say about this is that due to the convolution theorem, the described multiplication results in some form of a digital filter. That is all one can say about "modulating" the frequency domain with any sort of function.

BUT, based on this excellent exposition of the way parabolic equations can be solved via the Discrete Fourier Transform, it seems that the multiplication is performed in both the spatial and frequency domain to isolate specific parts of the signal "gracefully".

Now, the authors seem to indicate that the multiplication is done to "...avoid aliasing...", but I cannot see how the results of these operations can lead to aliasing when:


One is in full control of everything about the simulation
The first "plane" (the one that is generated at the source) would only contain harmonics form the desired spectrum and be zero elsewhere anyway.


So, I cannot see how extra harmonics are likely to creep in between integration steps to have a need to isolate them.

Therefore, a more likely reason might be to be able to "isolate" (or focus on) only a part of the domain in a graceful way, rather than setting it to zero.

Hope this helps.