爲什麼要使用拉普拉斯變換
我們通常把f(t)
的拉普拉斯變換寫成F(s)
,拉普拉斯變換的優點是能把微分方程寫成代數方程,而求解代數方程則要簡單的多
命令以及步驟
- 先使用
syms
定義變量 - 使用
laplace
對函數進行拉普拉斯變換
示例
-
常數a
syms a laplace(a) ans = 1/s^2
-
冪函數
二次方:octave:3> syms t; octave:4> laplace(t^2) ans = (sym) 2 ── 3 s
三次方:
octave:5> laplace(t^3) ans = (sym) 6 ── 4 s
四次方:
octave:6> laplace(t^4) ans = (sym) 24 ── 5 s
公式:
-
指數函數
octave:8> syms t b; octave:9> laplace(exp(-b*t)) ans = (sym) 1 ───── b + s
-
正弦函數
octave:10> syms w; octave:11> laplace(sin(w*t)) ans = (sym) w ─────── 2 2 s + w
-
餘弦函數
octave:12> syms w; octave:13> laplace(cos(w*t)) ans = (sym) s ─────── 2 2 s + w
-
雙曲正弦函數
octave:18> syms w t; octave:19> laplace(sinh(w*t)) ans = (sym) w ─────────────── (s - w)⋅(s + w)
-
雙曲餘弦函數
雙曲餘弦函數需要討論,比較複雜
octave:22> syms w t; octave:23> laplace(cosh(w*t)) ans = (sym) ⎧ ⅈ⋅π │ 2│ ⎪ -s⋅ℯ │s │ ⎪ ──────── for │──│ < 1 ⎪ 2 2 │ 2│ ⎪ s - w │w │ ⎪ ⎪ │ 2│ ⎪ s │w │ ⎪ ─────── for │──│ < 1 ⎨ 2 2 │ 2│ ⎪ s - w │s │ ⎪ ⎪ ⎛ │ 2⎞ ⎪ ╭─╮2, 1 ⎜ 1/2 0, 0 │ s ⎟ ⎪π⋅│╶┐ ⎜ │ ──⎟ ⎪ ╰─╯3, 3 ⎜0, 1/2 0 │ 2⎟ ⎪ ⎝ │ w ⎠ ⎪───────────────────────────── otherwise ⎩ w
拉普拉斯的變換是線性的
octave:25> f = 5+exp(-2*t);
octave:26> laplace(f)
ans = (sym)
2⋅(3⋅s + 5)
───────────
s⋅(s + 2)