MacのOctaveでfir1関数を使おうとしたら「ないっす」と言われたので取ってくる話しです。
fir1関数はsignalパッケージに入っていて、signalパッケージはcontrolパッケージに依存しています。なので、先にcontrolパッケージをインストールします。Octaveのコマンドウィンドウで
octave
>> pkg install -forge control
なにやら下記のようなwarningが出ますが、とりあえず終了します。
warning
In file included from __control_slicot_functions__.cc:44:
./sl_ib01ad.cc:146:17: warning: variable 'nsmpl' set but not used [-Wunused-but-set-variable]
F77_INT nsmpl = 0; // total number of samples
^
1 warning generated.
ld: warning: could not create compact unwind for _mb03xp_: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _sb10yd_: stack subq instruction is too different from dwarf stack size
For information about changes from previous versions of the control package, run 'news control'.
次に本命のsingalパッケージ取ってきます。
octave
>> pkg load signal
これは下記のメッセージとともに、すんなり終わります。
octave
For information about changes from previous versions of the signal package, run 'news signal'.
関数実行前には、パッケージをロードする必要があります。
octave
>> pkg load signal
インストールできると関数のhelpが表示できます。
octave
>> help fir1
'fir1' is a function from the file /Users/kikuchi/Library/Application Support/Octave.app/6.2.0/pkg/signal-1.4.5/fir1.m
-- Function File: B = fir1 (N, W)
-- Function File: B = fir1 (N, W, TYPE)
-- Function File: B = fir1 (N, W, TYPE, WINDOW)
-- Function File: B = fir1 (N, W, TYPE, WINDOW, NOSCALE)
....
pkg load signal は起動ファイル~/.octavercに書いておくと毎回実行為なくて済みます。