我必须制作过滤器,这是我的代码:
octave:1> x=randn(500);
octave:2> b=fir1(50,0.2,'stop',boxcar(51));
error: `boxcar' undefined near line 2 column 22
error: evaluating argument list element number 4
这里有什么问题?
在Octave中,低通滤波器是“低”还是“停止”?
@edit 新错误:
octave:2> b=fir1(50,0.2,'stop');
error: `fir1' undefined near line 2 column 3
我可能没有东西吗?
答案 0 :(得分:0)
来自man page:
usage: b = fir1(n, w [, type] [, window] [, noscale])
你可能想要例如:
b=fir1(50, [0.1 0.2], 'stop');
答案 1 :(得分:0)
您可能需要加载包(请参阅Octave FAQ)。运行pkg list
以确认已安装软件包以及是否已加载软件包。它将显示所有已安装软件包的表,并在加载的软件包前面加上星号。您将无法使用未加载的包。请参阅以下Octave会话。
octave> partcnt (7) # does not work because function is not in search path
error: `partcnt' undefined near line 9 column 1
octave> pkg list # show list of packages
Package Name | Version | Installation directory
---------------+---------+-----------------------
control | 2.4.1 | /home/carandraug/octave/control-2.4.1
general | 1.3.2 | /home/carandraug/octave/general-1.3.2
generate_html | 0.1.5 | /home/carandraug/octave/generate_html-0.1.5
image | 2.1.0 | /home/carandraug/octave/image-2.1.0
miscellaneous | 1.2.0 | /home/carandraug/octave/miscellaneous-1.2.0
optim | 1.2.2 | /home/carandraug/octave/optim-1.2.2
signal | 1.2.0 | /home/carandraug/octave/signal-1.2.0
specfun | 1.1.0 | /home/carandraug/octave/specfun-1.1.0
struct | 1.0.10 | /home/carandraug/octave/struct-1.0.10
octave> pkg load miscellaneous # load package
octave> partcnt (7) # it works now
ans = 15
octave> pkg list # confirm that package is loaded (* in front of the name)
Package Name | Version | Installation directory
---------------+---------+-----------------------
control | 2.4.1 | /home/carandraug/octave/control-2.4.1
general *| 1.3.2 | /home/carandraug/octave/general-1.3.2
generate_html | 0.1.5 | /home/carandraug/octave/generate_html-0.1.5
image | 2.1.0 | /home/carandraug/octave/image-2.1.0
miscellaneous *| 1.2.0 | /home/carandraug/octave/miscellaneous-1.2.0
optim | 1.2.2 | /home/carandraug/octave/optim-1.2.2
signal | 1.2.0 | /home/carandraug/octave/signal-1.2.0
specfun | 1.1.0 | /home/carandraug/octave/specfun-1.1.0
struct | 1.0.10 | /home/carandraug/octave/struct-1.0.10
octave> pkg unload all # unload the package
octave> partcnt (7) # no longer works because it was removed from path
error: `partcnt' undefined near line 15 column 1
octave> pkg list
Package Name | Version | Installation directory
---------------+---------+-----------------------
control | 2.4.1 | /home/carandraug/octave/control-2.4.1
general | 1.3.2 | /home/carandraug/octave/general-1.3.2
generate_html | 0.1.5 | /home/carandraug/octave/generate_html-0.1.5
image | 2.1.0 | /home/carandraug/octave/image-2.1.0
miscellaneous | 1.2.0 | /home/carandraug/octave/miscellaneous-1.2.0
optim | 1.2.2 | /home/carandraug/octave/optim-1.2.2
signal | 1.2.0 | /home/carandraug/octave/signal-1.2.0
specfun | 1.1.0 | /home/carandraug/octave/specfun-1.1.0
struct | 1.0.10 | /home/carandraug/octave/struct-1.0.10
加载miscellaneous
时自动加载常规包的原因是因为general
是miscellaneous
的依赖项。