Example 3
The third synthetic signal has intrawave fre- quency modulation:
$f_{\mathrm{Sig} 3}(t)=\frac{1}{1.2+\cos (2 \pi t)}+\frac{\cos (32 \pi t+0.2 \cos (64 \pi t))}{1.5+\sin (2 \pi t)} $
The signal, its three constituent modes, and the composite Fourier spectrum are shown in Fig. 11. While the first, bell-shaped component has mostly low-pass content, the second mode’s main peak is clearly identified at $32\pi$ . However, due to the non-linear intrawave frequency modulation, an important amount of higher-order harmonics are also observed. This second component obviously violates the narrow-band assumption, and one would naturally expect some difficulties recovering this mode using VMD.
The corresponding VMD results are illustrated in Fig. 11. The non-zero $\omega_2$ quickly converges to the correct main frequency $32\pi$ . The higher order harmonics are not uniquely attributed to the second mode, however, but shared between both modes. Consequently, the intrawave frequency modulation is shared by both modes, creating some ripples in the otherwise low-fre- quency mode.
julia> using VMD,Random,Plots
julia> T = 1000;
julia> t = (1:T)/T;
julia> sample_frequency = 1000;
julia> # modes
v_1 = @. 1.0/(1.2+cos(2π*t));
julia> v_2 = @. cos(32π*t+0.2cos(64π*t));
julia> v_3 = @. 1.5+sin(2π*t);
julia> # composite signal, including noise
f = v_1 + v_2./v_3 + 0.1*randn(length(v_1));
julia> # some sample parameters for VMD
alpha = 2000; # moderate bandwidth constraint
julia> tau = 0; # noise-tolerance (no strict fidelity enforcement)
julia> K = 3; # 3 modes
julia> DC = false; # no DC part imposed
julia> init = 0; # initialize omegas uniformly
julia> tol = 1e-7;
julia> v = vmd(f ; alpha = alpha,tau = tau,K = K,DC = false,init = init,tol = tol,sample_frequency = sample_frequency)
--iteration times 41 -- error 6.435732684758594e-8
julia> # the first mode frequency
print("1st mode frequency $(n_mode(v,1))")
1st mode frequency 0.389290871879802
julia> p0 = VMD.plot(v,k=0)
Plot{Plots.GRBackend() n=2}
julia> savefig(p0,"3_0.png")
/home/runner/.julia/packages/GR/BwGt2/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application
GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS
julia> p1 = VMD.plot(v,k=1)
Plot{Plots.GRBackend() n=2}
julia> savefig(p1,"3_1.png")
/home/runner/.julia/packages/GR/BwGt2/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application
GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS
julia> p2 = VMD.plot(v,k=2)
Plot{Plots.GRBackend() n=2}
julia> savefig(p2,"3_2.png")
/home/runner/.julia/packages/GR/BwGt2/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application
GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS
julia> p3 = VMD.plot(v,k=3)
Plot{Plots.GRBackend() n=2}
julia> savefig(p3,"3_3.png")
/home/runner/.julia/packages/GR/BwGt2/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application
GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS