使用MATLAB進行拉普拉斯變換

爲什麼要使用拉普拉斯變換

我們通常把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 
    		
    

    公式:1

  • 指數函數

    
    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 │──│ < 12    22│    
      ⎪          s  - w                   │w │    
      ⎪                                           
      ⎪                                   │ 2│    
      ⎪              s                    │w │    
      ⎪           ───────             for │──│ < 12    22│    
      ⎪           s  - w                  │s │    
      ⎪                                           
      ⎪          ⎛             │  2⎞              
      ⎪  ╭─╮2, 11/2    0, 0 │ s ⎟              
      ⎪π⋅│╶┐     ⎜             │ ──⎟              
      ⎪  ╰─╯3, 30, 1/2   02⎟              
      ⎪          ⎝             │ w ⎠              
      ⎪─────────────────────────────   otherwise  
      ⎩              w                            
    

拉普拉斯的變換是線性的

octave:25> f = 5+exp(-2*t);
octave:26> laplace(f)
ans = (sym)

  2(3⋅s + 5)
  ───────────
   s⋅(s + 2) 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章