Skip to main content
7-Bedrock
August 8, 2023
Solved

Mathcad stft function

  • August 8, 2023
  • 2 replies
  • 2340 views

How do I calculate the corresponding frequencies provided by the stft function?

 

 

 

Best answer by LB_9931683

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.  

2 replies

21-Topaz II
August 8, 2023

Hi,

Have you looked at the description and an example in help?

Cheers

Terry 

ttokoro
21-Topaz I
21-Topaz I
August 9, 2023

PTC_Mathcad_Help/example_the_short_time_fourier_transform.html#wwID0EXHA5

image.pngimage.png

But using dft function is more understandable.

image.pngimage.png

t.t.
LB_99316837-BedrockAuthorAnswer
7-Bedrock
August 17, 2023

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.  

ttokoro
21-Topaz I
21-Topaz I
August 18, 2023

 

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.

image.pngimage.pngimage.png

t.t.