spkit.cwt.cMaxicanHatWave

spkit.cwt.cMaxicanHatWave(t, f, f0=0, a=1)

Complex Maxican Hat Wavelet

Generate Wavelet functions to be used for analysis

\[ \begin{align}\begin{aligned}\psi(t) &= \frac{2}{\sqrt{3}} \pi^{-\frac{1}{4}}\left(\sqrt{\pi}(1-t^2)e^{-\frac{1}{2}t^2} - \left(\sqrt{2}jt + \sqrt{\pi}erf\left[\frac{j}{\sqrt{2}}t \right] (1-t^2)e^{-\frac{1}{2}t^2}\right)\right)e^{-2\pi jf_0 t}\\\psi(w) &= 2\sqrt{\frac{2}{3}}\pi^{-1/4}(w-w_0)^2e^{-\frac{1}{2} (w-w_0)^2} \quad \text{ if $w\ge 0$,}\quad \text{ 0 else}\end{aligned}\end{align} \]

where

\(w = 2\pi f\) and \(w_0 = 2\pi f_0\)

Parameters:
t: 1d array,
  • time span array corresponding to signal for analysis,

  • must be centered at 0

f: 1d array,
  • frquency array for wavelet analysis

f0: array , default=0
  • array of center frquencies for wavelets

  • np.linspace(1,40,100) [scale value]

a: float or array, default 1.0
  • oscillation parameter, could be an array (not suggeestive)

Returns:
wttime-domain wavelet(s)
wffrequency-domain wavelet(s)

See also

ScalogramCWT

Notes

It is efficient and easy to use ScalogramCWT with wType==’cMaxican’ code:

XW,S = ScalogramCWT(x,t,fs=fs,wType='cMaxican',PlotPSD=True)

References

Examples

#sp.cwt.cMaxicanHatWave
import numpy as np
import matplotlib.pyplot as plt
import spkit as sp
fs = 100                              #sampling frequency
t = np.linspace(-5,5,fs*10+1)         #time
f = np.linspace(-10,10,2*len(t)-1)    #frequency range
#f = np.linspace(-fs//2,fs//2,2*len(t))   #frequency range
wt1,wf1 = sp.cwt.cMaxicanHatWave(t,f=f,f0=0,a=1)
wt2,wf2 = sp.cwt.cMaxicanHatWave(t,f=f,f0=5,a=0.1)
plt.figure(figsize=(10,5))
plt.subplot(221)
plt.plot(t,wt1.T.real,label='real')
plt.plot(t,wt1.T.imag,'-',label='image')
plt.xlim(t[0],t[-1])
plt.ylabel('a=1, f0=0')
plt.subplot(222)
plt.plot(f,abs(wf1.T))
plt.xlim(f[0],f[-1])
plt.subplot(223)
plt.plot(t,wt2.T.real,label='real')
plt.plot(t,wt2.T.imag,'-',label='image')
plt.xlim(t[0],t[-1])
plt.xlabel('time')
plt.ylabel('a=0.1, f0=5')
plt.subplot(224)
plt.plot(f,abs(wf2.T))
plt.xlim(f[0],f[-1])
plt.xlabel('Frequency')
plt.suptitle('Complex MaxicanHat Wavelet')
plt.tight_layout()
plt.show()
../../_images/spkit-cwt-cMaxicanHatWave-1.png