• 用于符号数学的 Python 库——sympy(二):常用信号的Laplace变换


    关于拉普拉斯变换的作用,可参考知乎
    总的来说,拉普拉斯变换就是迫使函数满足绝对可积条件的傅里叶变换。

    常用信号的Laplace变换

    参考信号与系统/陈后金, 胡健, 薛健. ——2版.——北京:清华大学出版社;北京交通大学出版社, 2005.7(2017.3重印)第218-219页。

    序号      单边信号(f(t))      Laplace变换( F ( s ) F(s) F(s))      收敛域      
    1 e − λ t u ( t ) e^{-\lambda t}u(t) eλtu(t) 1 s + λ \frac{1}{s+\lambda} s+λ1 R e ( s ) > − λ Re(s)>-\lambda Re(s)>λ
    2 e j ω 0 t u ( t ) e^{j\omega_0 t}u(t) ejω0tu(t) 1 s − j ω 0 \frac{1}{s-j\omega_0} sjω01 R e ( s ) > 0 Re(s)>0 Re(s)>0
    3 c o s ( ω 0 t ) u ( t ) cos(\omega_0 t)u(t) cos(ω0t)u(t) s s 2 + ω 0 2 \frac{s}{s^2+\omega_0^2} s2+ω02s R e ( s ) > 0 Re(s)>0 Re(s)>0
    4 s i n ( ω 0 T ) u ( t ) sin(\omega_0 T)u(t) sin(ω0T)u(t) ω 0 s 2 + ω 0 2 \frac{\omega_0}{s^2+\omega_0^2} s2+ω02ω0 R e ( s ) > 0 Re(s)>0 Re(s)>0
    5 e − σ 0 t c o s ( ω t ) u ( t ) e^{-\sigma_0 t}cos(\omega t)u(t) eσ0tcos(ωt)u(t) s + σ 0 ( s + σ 0 ) 2 + ω 0 \frac{s+\sigma_0}{(s+\sigma_0)^2+\omega_0} (s+σ0)2+ω0s+σ0 R e ( s ) > − σ 0 Re(s)>-\sigma_0 Re(s)>σ0
    6 e − σ 0 t s i n ( ω t ) u ( t ) e^{-\sigma_0 t}sin(\omega t)u(t) eσ0tsin(ωt)u(t) ω 0 ( s + σ 0 ) 2 + ω 0 \frac{\omega_0}{(s+\sigma_0)^2+\omega_0} (s+σ0)2+ω0ω0 R e ( s ) > − σ 0 Re(s)>-\sigma_0 Re(s)>σ0
    7 δ ( t ) \delta(t) δ(t)1 R e ( s ) > − ∞ Re(s)>-\infty Re(s)>
    8 δ ( n ) ( t ) \delta^{(n)}(t) δ(n)(t) s n ( 1 , 2 , …   ) s^n(1,2,\dots) sn(1,2,) R e ( s ) > − ∞ Re(s)>-\infty Re(s)>
    9 u ( t ) u(t) u(t) 1 s \frac{1}{s} s1 R e ( s ) > 0 Re(s)>0 Re(s)>0
    10 t u ( t ) tu(t) tu(t) 1 s 2 \frac{1}{s^2} s21 R e ( s ) > 0 Re(s)>0 Re(s)>0
    11 t n u ( t ) t^n u(t) tnu(t) n ! s n + 1 \frac{n!}{s^{n+1}} sn+1n! R e ( s ) > 0 Re(s)>0 Re(s)>0
    12 t e − λ t u ( t ) te^{-\lambda t}u(t) teλtu(t) 1 ( s + λ ) 2 \frac{1}{(s+\lambda)^2} (s+λ)21 R e ( s ) > − λ Re(s)>-\lambda Re(s)>λ

    1. e − λ t u ( t ) e^{-\lambda t}u(t) eλtu(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    lamb = symbols('\lambda')
    F1 = laplace_transform(exp(-lamb*t)*Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    1 λ + s \displaystyle \frac{1}{\lambda + s} λ+s1

    F1[1]
    
    • 1

    − λ \displaystyle - \lambda λ

    2. e j ω 0 t u ( t ) e^{j\omega_0 t}u(t) ejω0tu(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    w0 = symbols('\omega_0')
    F1 = laplace_transform(exp(np.complex(0,1)*w0*t)*Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    1 − 1.0 i ω 0 + s \displaystyle \frac{1}{- 1.0 i \omega_{0} + s} 1.0iω0+s1

    3. c o s ( ω 0 t ) u ( t ) cos(\omega_0 t)u(t) cos(ω0t)u(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    w0 = symbols('\omega_0')
    F1 = laplace_transform(cos(w0*t)*Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    s ω 0 2 + s 2 \displaystyle \frac{s}{\omega_{0}^{2} + s^{2}} ω02+s2s

    4. s i n ( ω 0 T ) u ( t ) sin(\omega_0 T)u(t) sin(ω0T)u(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    w0 = symbols('\omega_0')
    F1 = laplace_transform(sin(w0*t)*Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    ω 0 ω 0 2 + s 2 \displaystyle \frac{\omega_{0}}{\omega_{0}^{2} + s^{2}} ω02+s2ω0

    5. e − σ 0 t c o s ( ω t ) u ( t ) e^{-\sigma_0 t}cos(\omega t)u(t) eσ0tcos(ωt)u(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    w0,sigma0 = symbols('\omega_0 \sigma_0')
    F1 = laplace_transform(exp(-sigma0*t)*cos(w0*t)*Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    σ 0 + s ( − i ω 0 + σ 0 + s ) ( i ω 0 + σ 0 + s ) \displaystyle \frac{\sigma_{0} + s}{\left(- i \omega_{0} + \sigma_{0} + s\right) \left(i \omega_{0} + \sigma_{0} + s\right)} (iω0+σ0+s)(iω0+σ0+s)σ0+s

    6. e − σ 0 t s i n ( ω t ) u ( t ) e^{-\sigma_0 t}sin(\omega t)u(t) eσ0tsin(ωt)u(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    w0,sigma0 = symbols('\omega_0 \sigma_0')
    F1 = laplace_transform(exp(-sigma0*t)*sin(w0*t)*Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    ω 0 ( − i ω 0 + σ 0 + s ) ( i ω 0 + σ 0 + s ) \displaystyle \frac{\omega_{0}}{\left(- i \omega_{0} + \sigma_{0} + s\right) \left(i \omega_{0} + \sigma_{0} + s\right)} (iω0+σ0+s)(iω0+σ0+s)ω0

    7. δ ( t ) \delta(t) δ(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    F1 = laplace_transform(DiracDelta(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    1 \displaystyle 1 1

    8. δ ( n ) ( t ) \delta^{(n)}(t) δ(n)(t)

    n次求导无法计算,用多个数字代替,总结规律(不严谨) 结果看不懂

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    delta,n = symbols('\delta n')
    F1 = laplace_transform(DiracDelta(t,2),t,s)
    
    F1
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    L t [ δ ( 2 ) ( t ) ] ( s ) \displaystyle \mathcal{L}_{t}\left[\delta^{\left( 2 \right)}\left( t \right)\right]\left(s\right) Lt[δ(2)(t)](s)

    9. u ( t ) u(t) u(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    delta,n = symbols('\delta n')
    F1 = laplace_transform(Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    1 s \displaystyle \frac{1}{s} s1

    10. t u ( t ) tu(t) tu(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    delta,n = symbols('\delta n')
    F1 = laplace_transform(t*Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    1 s 2 \displaystyle \frac{1}{s^{2}} s21

    11. t n u ( t ) t^n u(t) tnu(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    delta,n = symbols('\delta n')
    F1 = laplace_transform(t**n*Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    s − n Γ ( n + 1 ) s \displaystyle \frac{s^{- n} \Gamma\left(n + 1\right)}{s} ssnΓ(n+1)

    12. t e − λ t u ( t ) te^{-\lambda t}u(t) teλtu(t)

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    lamb,n = symbols('\lambda n')
    F1 = laplace_transform(t*exp(-lamb*t)*Heaviside(t),t,s)
    
    F1[0]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    1 ( λ + s ) 2 \displaystyle \frac{1}{\left(\lambda + s\right)^{2}} (λ+s)21

    至于 Γ \Gamma Γ函数
    Γ ( x ) = ∫ 0 + ∞ t x − 1 e − t d t \Gamma(x)=\int_0^{+\infty}t^{x-1}e^{-t}dt Γ(x)=0+tx1etdt
    x x x为正整数时,
    Γ ( n ) = ( n − 1 ) ! \Gamma(n)=(n-1)! Γ(n)=(n1)!

    逆Laplace变换

    逆Laplace变换与Laplace变换函数用法大致一致,举一个简单例子,对于 e − λ t u ( t ) e^{-\lambda t}u(t) eλtu(t)的拉普拉斯变换,输出结果为
    1 λ + s \frac{1}{\lambda+s} λ+s1,那么对于 1 λ + s \frac{1}{\lambda+s} λ+s1的逆拉普拉斯变换,代码为

    from sympy import *
    from sympy.integrals import laplace_transform,inverse_laplace_transform
    
    lamb,s,t = symbols('\lambda s t')
    F1 = inverse_laplace_transform(1/(lamb+s),s,t)
    
    F1
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    e − t re ⁡ ( λ ) − i t im ⁡ ( λ ) θ ( t ) \displaystyle e^{- t \operatorname{re}{\left(\lambda\right)} - i t \operatorname{im}{\left(\lambda\right)}} \theta\left(t\right) etre(λ)itim(λ)θ(t)
    结果的 θ ( t ) \theta(t) θ(t)就是 u ( t ) u(t) u(t)

  • 相关阅读:
    腾讯云拼了99元服务器老用户能买,续费不涨价!
    bjpowernode_MyBatis
    STM32系列(HAL库)——串口IAP
    Unity 切换场景后场景变暗
    net-java-php-python-汽车租赁系统计算机毕业设计程序
    Python对json文件的读取和处理
    TiDB-PCTP考试复习
    java毕业设计-基于springboot vue的地方美食分享网站-毕业论文+答辩PPT(附源代码+演示视频)
    c# 单例模式传参且线程安全
    重生奇迹MU天空之城玩转攻略
  • 原文地址:https://blog.csdn.net/u011740601/article/details/127883982