首页 > 解决方案 > 八度无法绘制频谱图

问题描述

我正在使用 octave 中的代码来打印这样的 Spectogram。代码来自实验室手册,但我遇到了错误。 在此处输入图像描述

编码

[x, Fs, bps] = wavread('digit.wav');

alpha=0.5; %Overlap
N=256;% 32ms window size
figure(2)
clf()
specgram(x,N,Fs,hanning(N),alpha*N);
xlabel('Time (s)', "fontsize", 18)
ylabel('Frequency (Hz)', "fontsize", 18)

错误

>> spectogram
warning: wavread is obsolete and will be removed from a future version of Octave,please use audioread instead
warning: called from
    wavread at line 62 column 5
    spectogram at line 1 column 11
error: 'specgram' undefined near line 7 column 1
error: called from
    spectogram at line 7 column 1

标签: plotoctave

解决方案


  1. 正如警告所暗示的,wavread已过时,您应该audioread改用
  2. specgram函数是signal包的一部分。要使用它,您应该首先加载信号包:pkg load signal. 如果您还没有安装它,请先从 octave forge 安装它:pkg install signal -forge.

推荐阅读