S变换的Python代码

S变换的Python代码

S变换简介

S变换,又称为Stockwell变换,由R. G. Stockwell于1996年提出。具体的定义如下:
在这里插入图片描述
S变换在傅里叶域的表示形式为:
在这里插入图片描述
离散的S变换为:
在这里插入图片描述
S变换克服了短时傅里叶变换固定窗函数宽度的缺陷,采用了一个随频率变化的高斯窗函数。它的窗函数宽度与频率的倒数成正比,高频时用窄窗,低频用宽窗。所以具有多分辨率分析的思想,也可以看作相位校正的小波变换。

S变换Python程序

def st(t,s, freqlow, freqhigh, alpha):
    TimeLen=len(t)
    dt=t[1]-t[0]
    nLevel=int((freqhigh-freqlow)/alpha)+1
    fre=np.linspace(freqlow,freqhigh,nLevel)
    wcoefs=np.zeros((nLevel,TimeLen),dtype=complex)
    temp = np.zeros((1, TimeLen),dtype=complex)
    sigma_f = np.power(fre,-1)
    for m in range(0,nLevel):
        f=fre[m]
        for n in range(0,TimeLen):
            Gauss_st= (1/(math.sqrt(2*math.pi)*sigma_f[m]))*np.exp(-0.5*(np.power(n*dt-t,2)/(sigma_f[m]*sigma_f[m])))*np.exp(-1.0j*2*math.pi*f*t)
            temp[0,n]=np.sum(np.dot(s, Gauss_st))*dt
        wcoefs[[m],:]=temp
    return wcoefs

R. G. Stockwell, L. Mansinha, and R. Lowe, “Localization of the
complex spectrum: the S transform,” IEEE transactions on signal
processing, vol. 44, no. 4, pp. 998–1001, 1996.

  • 2
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值