M73ACat / SGMD

A simple program to implement the Symplectic geometry mode decomposition (SGMD), including python and matlab versions.
MIT License
22 stars 2 forks source link

Exploration of problems related to endpoint effect #3

Open M73ACat opened 1 year ago

M73ACat commented 1 year ago

It can be observed that both python and matlab decomposition results show some endpoint effect in the example. To locate the causes of endpoint effects in SGMD, the following work was performed:

  1. Firstly, the simulation signal (5120 Hz, 1 s) is extended by adding 0.1 s signals before and after the signal, respectively, i.e. [0 s, 1 s] -> [-0.1 s, 1.1 s], and the related programs are as follows:

    
    def sim_sig(time=1, st=0):
    """  
    inputs:
        time: sampling time of the signal
        st: start time of the signal
    outputs:
        each sub-signal, tuple
        fs, sample frequency
        t, time series
        sig, simulation signal
    """
    fs = 5120
    t = np.arange(st, time, 1/fs)
    x1_t = 2*(1+0.5*(np.sin(2*np.pi*t)))*np.sin(60*np.pi*t)
    x2_t = np.sin(120*np.pi*t)
    x3_t = 0.5*np.cos(10*np.pi*t)
    sig = x1_t + x2_t + x3_t
    
    return (x1_t, x2_t, x3_t), fs, t, sig

""" establish the extended signal sig and time series t """ _, fs, t, sig = sim_sig(1.1 ,-0.1) """ create the original signal sig2, the sub-signal sub_sig and time series t2 """ subsig, , t2, sig2 = sim_sig(1)

A comparison of the original signal and the extended signal is obtained as Fig.1:
<div align=center>
<img src=https://user-images.githubusercontent.com/72395068/231637394-88614519-68b1-4752-ad03-2af34e6cf8a0.png>
<div>Fig.1 Comparison of the original signal and the extended signal, where black is the 1.2 s long extended signal and red is the 1 s long original signal</div>
</div>
2. Perform the sgmd decomposition on both signals with parameters of 256, 0.8 and 0.001, respectively, and the d values during decomposition are 307.

``` python
""" sig -> SGCs1 """
sgmd = SGMD(sig, fs, nfft=nfft, threshold_corr=0.8, threshold_nmse=0.001, mode='eig')
SGCs1 = sgmd.sgmd()
""" sig2 -> SGCs2 """
sgmd = SGMD(sig2, fs, nfft=nfft, threshold_corr=0.8, threshold_nmse=0.001, mode='eig')
SGCs2 = sgmd.sgmd()
  1. Extract the [0 s, 1 s] part of the results and obtain the decomposition results of the extended signal and the original signal respectively in Fig. 2 and Fig. 3, in which the red lines are the original signals and the blue lines are the decomposition results.
Fig.2 Decomposition results of the extended signal
Fig.3 Decomposition results of the original signal

It can be observed that the endpoint effect is improved, and this result can show to a certain extent that the extension can improve the endpoint effect of the sgmd decomposition. However, further research is needed on which extension method should be used in practical applications.