【问题标题】:resample function in Octave?Octave中的重采样功能?
【发布时间】:2020-12-18 15:04:07
【问题描述】:

我正在尝试将 MATLAB 脚本转换为 Octave 文件。我正在使用 Octave 4.0。

在 MATLAB 脚本中,我遇到了格式为 resample(X, tx, fx) 的行。这个重采样函数在 Octave 中是否有任何等效函数?

我不是在寻找函数resample(X, p, q)。

根据 Mathworks 网站: y = resample(x,p,q) 以原始采样率的 p/q 倍重新采样输入序列 x。 y = resample(x,tx,fs) 使用多相抗混叠滤波器以 fs 中指定的统一采样率重新采样信号。

【问题讨论】:

    标签: matlab octave


    【解决方案1】:

    请输入八度:

     >>  help resample
    

    答案是(在我的电脑上我之前已经安装过这个包):

    error: help: 'resample' 函数属于信号包 来自您已安装但未加载的 Octave Forge。加载 包,在 Octave 提示符下运行 `pkg load signal'。

    您必须安装和加载信号包。请参阅根 Octave 目录中的文件 README.html 中的说明(来自 Windows 发行版的示例):

    • 运行脚本 build_packages.m 来构建和安装包。 安装是一次性的过程。安装包后必须 仍然被加载以便与 pkg load PACKAGENAME 一起使用它们 命令。

    【讨论】:

      【解决方案2】:

      在文档here 中说有一个。您应该可以像在文档中一样使用它。

      [y, h] = resample (x, p, q)
      

      【讨论】:

        【解决方案3】:

        对于那些需要 Matlab 的 resample() 提供但 Octave 的 resample() 不提供的非均匀到均匀重采样的人,您可以改用 interp1()。

         y = resample(X, tx, fs)
        

        可以转换为

         samplecount = (max(tx) - min(tx)) * fs
         y = interp1(tx, X, linspace(min(tx), max(tx), samplecount))
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2013-12-27
          • 2020-10-03
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-05-18
          • 1970-01-01
          相关资源
          最近更新 更多