MATLAB has built-in functions taking care of the steps you mention in 2. You can check out the pwelch function (here) which uses Welch's method for PSD estimation.(here)
The choice of segment length, number, overlap and windowing function presents a trade-off between bias and variance.
Moving average filter is a good smoothing filter in time domain but is a bad low pass filter in frequency domain due to slow roll off and bad stop band attenuation. It is important to look at the time and frequency response of the filters before deciding on them.
1) Is this a theoretically accepted method to smooth data in DFT domain or only applies in time domain ?
Sort of. It certainly can be done this way. Doing it directly in the DFT (instead of the PSD) is risky since it's a complex number you can get a lot of cancellation if the phase is fluctuating a lot.
You also need to decide how you manage the "edges": ...
50% overlapped Von Hann windows have constant gain when simply summed together. No “pulsing”.
However if you filter each window separately, and don’t use zero-padding plus overlap add-save convolution, any filtering in the frequency domain will most likely not perform as you intend, as, depending on the impulse response of the filtering, changes to data ...
When you filter a finite length signal, the filtered output will have a larger length, either you implement the filter in time domain or frequency domain. Your desired continuity comes from this excess part which must be added to the result of next segment or window.
For example when you take N samples of a signal and filter it with a filter of length M, ...
Apply window function to each overlapped window, and then simply draw
the FFT magnitude response of each window as if the spectrum
corresponds to the center time of the window.
Your approach is partially correct. But in the second half of sentence is not how you draw a spectrogram. You shouldn't align the FFT output in the same direction as time. It ...
So after taking fft(X(m)), the windowed N-point FFT is simply the above three equations?
X(m) is already in frequency domain. It is the mth value of fft(x(n)) where x(n) is a discrete time signal.
Is windowed FFT called smoothing?
In the context of windowing, smoothing of a signal is done to reduce the spectral leakage caused by the truncation of a signal ...
I modified the code to do Hamming window filtering (window input signal with time domain of window). Since I do not have your dat file, I assumed random values. X_t is the time domain signal corresponding to X. This needs to be windowed with hamming window. (convolution in frequency domain)
time = 5; % in nano-seconds
z0 = 50;
You get the time domain values of hamming window from the hamming function. Multiplying it with the frequency domain data will not give the correct result. Smoothing is usually performed by multiplying in time domain. You could try multiplying the fourier transform of hamming window with the Frequency domain signal. and then performing the inverse fft.