# Is there any clear explain and simple how to decide what is the best frequency resolution and how to chose the window size for this signal

7 views (last 30 days)
hala siddiq on 29 Jun 2021
Answered: Yazan on 30 Jun 2021
If I know the sampling frequency is fs=10000 and the length of the signal 60.06 s
how can i calculate the number of point , window size?

Yazan on 30 Jun 2021
The question is unclear.
• If you are asking about the number of points in your signal (i.e., number of samples), then it is simply: N = Fs*T, where Fs is the sampling frequency and T is the signal duration. In your example N = 600600 samples.
• If the question is about a suitable window length to perform spectral or time-frequency analysis, it gets more tricky. Any spectral analysis is time-limited (you cannot record a signal forever). Namely, any signal's record can be thought of as the original signal (i.e., before the recording process) multiplied by a rectangular window whose length is the record's time duration. Windowing the raw signal has an impact, however. It diminishes the ability to distinguish between frequency components when they are close or when their amplitudes are very similar. Any window is characterized by two quantities: the dynamic range and the resolution. The DFT of a windowing function shows a main lobe and side lobes, which are usually weaker. The narrower the main lobe, the better the ability of the window to distinguish between closely placed frequency components. The lower the amplitudes of the side lobes, the better the window's ability to distinguish between frequency components of different amplitudes. Unfortunately, windows that are good for the first objective tend to be worse for the second. The rectangular window has the best resolution (the main lobe is narrow), but it has a bad dynamic range (the side lobes are strong). Therefore, in several practical applications, other windows are preferred, such as Hann and Hamming, as they better compromise between resolution and dynamic range. This behavior can somehow be quantified through the equivalent noise bandwidth of the window.
• In the context of time-frequency analysis through the spectrogram, the wider the analysis window, the better the spectral resolution and the worse the temporal resolution. To detect transient events, hence, you should use a shorter window. Of course, when the window length is equal to the signal's duration, the time-frequency analysis becomes a spectral analysis.
• In MatLab, you can use pspectrum perform spectral and time-frequency analysis. There is an excellent description of the algorithms used to perform the analyses and the rationale behind the default values assigned to the parameters. You can start with the default values. The choice of the window is eventually dependent on the application at hand.

R2018a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!