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
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));
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.