Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
How do I calculate the corresponding frequencies provided by the stft function?
Solved! Go to Solution.
Unfortunately, the help and documentation is not clear on calculating frequency which is more or less automatic within competitive products. However by trial and error, it appears that stft returns content with max frequency aprox equal to sampling frequency. Consequently, half of the requested frequencies will be withn the nyquist frequency. There is still some issue related to the size and indexing (origin=0 or 1, and max length of the returned vector). Index/length*sampling frequency is the best aproximation I've been able to use.
I prefer DFT for some analysis, but the easiest way to create a spectrogram is with stft.
Hi,
Have you looked at the description and an example in help?
Cheers
Terry
PTC_Mathcad_Help/example_the_short_time_fourier_transform.html#wwID0EXHA5
But using dft function is more understandable.
Unfortunately, the help and documentation is not clear on calculating frequency which is more or less automatic within competitive products. However by trial and error, it appears that stft returns content with max frequency aprox equal to sampling frequency. Consequently, half of the requested frequencies will be withn the nyquist frequency. There is still some issue related to the size and indexing (origin=0 or 1, and max length of the returned vector). Index/length*sampling frequency is the best aproximation I've been able to use.
I prefer DFT for some analysis, but the easiest way to create a spectrogram is with stft.
Plot data with dft and stft is almost same. The original wave has 1 for magnitude. dft for each 32 data must devide by 16. The one for stft must devide by 2.828. Never use w>0 for stft when you want to get real magnitude value.