LoginSignup
4
3

More than 1 year has passed since last update.

ControlSystems.jl を使ってみる

Last updated at Posted at 2021-12-05

https://qiita.com/advent-calendar/2021/thesense
the sense アドベントカレンダー2021の5日分です!

ControlSystems.jl

Juliaで制御工学をするパッケージです。
本記事では伝達関数を定義して周波数解析のBode線図と過渡解析もやります。

実行

Jupyter Notebookで実行しています。

パッケージ読み込み

using ControlSystems

伝達関数の定義

ここでは一例として伝達関数$G(s)$が次のような式で表されるRCローパスフィルタを扱います。
$$
G(s) = \frac{ \frac{1}{CR} }{ s + \frac{1}{CR} }
$$

$R = 1 \text{k}\Omega, ~~ C = 1 \mu\text{F}$としておきます。

ControlSystems.jlのtfで次のように定義します。

R = 1 * 10^3
C = 1 * 10^(-6)

G = tf(1/R*C, [1,1/R*C])

ボード線図

ControlSystems.jlのbodeplotでBode線図を出力します。 Plots.jl を使っていて、Plots.plotのパラメータが入れられます。

bodeplot(G)

インパルス応答

ControlSystems.jlのimpulseでインパルス応答を生成します。 図の出力には Plots.jl を使いました。

using Plots

y, t, x = impulse(G)
plot(t, x', xlabel="Time [s]", legend=false, xlims=(0, 10^(10)+10^9))

最後に

お手軽に伝達関数からBode線図を出力できるので、このパッケージの関数で伝達関数を生成できる場合には使えそうです。

参考

4
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3