Mfilter

Gem Version

MatLab (Octave) ライクの filter 関数の Ruby 実装。

インストール方法

インストールが必要なパッケージ

sudo apt update
sudo apt install liboctave-dev -y

or

brew install octave


> Gemfile
```ruby
gem "mfilter"

Gem のインストールを実行:

$ bundle install

Gem のインストール

$ gem install mfilter

使用例

#!/usr/bin/env ruby

require "mfilter"

t = Array.new(100){|i| -Math::PI + i * 2 * Math::PI / (100 - 1)}
x = t.map{|e| Math::sin(e) + 0.25 * rand}
b = [0.2] * 5
a = [1]

y = MFilter::filter(b, a, x)

open("test/data.dat", "w") do |f|
    f.puts [t, x, y].transpose.map{|e| e.join(" ")}
end

example

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/himeyama/mfilter.