To scale values from Matlab's spectrogram to real range

老子叫甜甜 提交于 2019-12-13 08:56:27

问题


I run

spectrogram(data, 64, 60, 256, 2,  'yaxis');

I get

I want to get range from 0 to 180 Hz, instead of normalised range from 0 to 1. I can change axis by

axis([0 450 0 180])

but it does not change the values.

I run unsuccessfully

spectrogram(180 .* data, 64, 60, 256, 2,  'yaxis');

How can you scale the range from normalised to real range?


回答1:


The x-axis should be frequency. You need to know the sampling rate fs (is it 2 ?) of data. Then the frequency range will be (0:63)/64*fs

Actually you can get the frequency output in the spectrogram function:

[B,F,T]=spectrogram(data,64,60,256,2);  % if fs = 2 in your case

F is the frequency range.



来源:https://stackoverflow.com/questions/20748139/to-scale-values-from-matlabs-spectrogram-to-real-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!