Matlab 的频谱图过时与频谱图替换

发布于 2024-09-10 06:17:37 字数 272 浏览 4 评论 0原文

在 Matlabs 最新版本中,specgram 函数被 spectrogram 取代,文档指出:

注意。要为删除的频谱图函数获得相同的结果,请指定长度为 256 的“Hann”窗口。

不幸的是,如果我使用频谱图( signal,hann(256)),结果与 specgram(signal) 不同,尽管两者非常相似。有没有办法获得完全相同的输出?

In Matlabs recent versions, the specgram function is being replaced by spectrogram, and the documentation states:

Note. To obtain the same results for the removed specgram function, specify a 'Hann' window of length 256.

Unfortunately, that doesn't seem to work for me, if I use spectrogram(signal,hann(256)), the result is different from specgram(signal), although both are quite similar. Is there a way to get the exact same output?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

温暖的光 2024-09-17 06:17:37

好吧,我只是偶然发现了解决方案:

specgram(singal) =spectrogram(signal, hanning(256))

因为 hannhanning 不是' Matlab 中也有同样的事情。

感谢大家的支持。

Well, I just stumbled upon the solution:

specgram(singal) = spectrogram(signal, hanning(256))

since hann and hanning aren't the same thing in Matlab.

Thanks everyone for the support.

辞取 2024-09-17 06:17:37

我相信它们在每个函数中的计算有点不同。这是我能得到的最好的:

sig = rand(1280,1);
Fs = 2;
nfft = 256;
numoverlap = 128;
window = hanning(nfft);

%# specgram
subplot(121), specgram(sig,nfft,Fs,window,numoverlap)

%# spectrogram: make it look like specgram
[S,F,T,P] = spectrogram(sig,window,numoverlap,nfft,Fs);
subplot(122), imagesc(T, F, 20*log10(P))
axis xy, colormap(jet), ylabel('Frequency')

频谱图

I believe they are computed a bit differently in each function. This is the best I could obtain:

sig = rand(1280,1);
Fs = 2;
nfft = 256;
numoverlap = 128;
window = hanning(nfft);

%# specgram
subplot(121), specgram(sig,nfft,Fs,window,numoverlap)

%# spectrogram: make it look like specgram
[S,F,T,P] = spectrogram(sig,window,numoverlap,nfft,Fs);
subplot(122), imagesc(T, F, 20*log10(P))
axis xy, colormap(jet), ylabel('Frequency')

spectrogram

飘过的浮云 2024-09-17 06:17:37

我目前没有 Matlab 可以尝试,但是 hann(256,'periodic') 可能就是您要找的。

I don't currently have Matlab to try, but hann(256,'periodic') might be what you're looking for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文