@@ -10,31 +10,39 @@ using ContinuousWavelets, Plots, Wavelets, FFTW, Logging
1010using Plots; gr()
1111Plots.reset_defaults()
1212n= 2047;
13- function mapTo(waveType, isReal=true,window=1:2047; d=1, kwargs...)
14- if isReal
15- c = wavelet(waveType; β=d, kwargs...)
16- waves,ω = computeWavelets(n,c)
17- return circshift(irfft(waves,2*n,1),(1024,0))[window,:]
18- else
19- c = wavelet(waveType; β=d, kwargs...)
20- waves,ω = computeWavelets(n,c)
21- waves = cat(waves, zeros(2047,size(waves,2)),dims=1)
22- return circshift(ifft(waves,1),(1024,0))[window,:]
23- end
13+ function mapTo(waveType, isReal = true, window = 1:2047; d = 1, γ = 4.0, β = 2.0, cf = 1.0, kwargs...)
14+ if waveType == Morse
15+ morse_wav = Morse(float(γ), float(β), float(cf))
16+ c = wavelet(morse_wav; kwargs...)
17+ else
18+ c = wavelet(waveType; β=d, kwargs...)
19+ end
20+ waves, ω = computeWavelets(n, c)
21+ if isReal
22+ return circshift(irfft(waves, 2*n, 1), (1024, 0))[window, :]
23+ else
24+ waves = cat(waves, zeros(2047, size(waves, 2)), dims = 1)
25+ return circshift(ifft(waves, 1), (1024, 0))[window, :]
26+ end
2427end
25- tmp = mapTo(Morlet(π),false;averagingLength=-0.2)[:,2]
26- p1=plot([real.(tmp) imag.(tmp)], title="Morlet", labels=["real" "imaginary"], ticks=nothing,linewidth=5)
27- tmp = mapTo(paul2,false,averagingLength=-.5)[:,2]
28- p2=plot([real.(tmp) imag.(tmp)],title="Paul 2", labels=["real" "imaginary"],ticks=nothing,linewidth=5)
29- p3=plot(mapTo(dog2;averagingLength=-1.5)[:,2],title="derivative of gaussians (dog2)",legend=false,ticks=nothing,linewidth=5)
30- p4=plot(mapTo(cHaar,true; averagingLength=1)[:,2],title="Haar",legend=false,ticks=nothing,linewidth=5)
31- p5=plot(mapTo(cBeyl, true; d=1, averagingLength=-0)[:,2], title="Beylkin", legend=false, ticks=nothing, linewidth=5)
32- p6=plot(mapTo(cVaid, true; d=1, averagingLength=-0)[:,2], title="Vaidyanathan", legend=false, ticks=nothing, linewidth=5)
33- p7=plot(mapTo(cDb2;d=1,averagingLength=-0)[:,2],title="Daubechies 2",legend=false,ticks=nothing,linewidth=5)
34- p8=plot(mapTo(cCoif2, true;d=1, averagingLength=-0)[:,2],title="Coiflet 2",legend=false,ticks=nothing,linewidth=5)
35- p9=plot(mapTo(cSym4, true; d=1,averagingLength=-0)[:,2],title="Symlet 4",legend=false,ticks=nothing,linewidth=5)
36- k = 0600; p10=plot(mapTo(cBatt4, true, 1024-k:1024+k;d=1,averagingLength=-1)[:,2],title="Battle-Lemarie, 4",legend=false,ticks=nothing,linewidth=5)
37- plot(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,layout=(2,5),size=300 .*(5, 2.2))
28+ tmp = mapTo(Morlet(π), false; averagingLength = -0.2)[:, 2]
29+ p1 = plot([real.(tmp) imag.(tmp)], title = "Morlet", labels = ["real" "imaginary"], ticks = nothing, linewidth = 5)
30+ tmp = mapTo(paul2, false, averagingLength = -0.5)[:, 2]
31+ p2 = plot([real.(tmp) imag.(tmp)], title = "Paul 2", labels = ["real" "imaginary"], ticks = nothing, linewidth = 5)
32+ tmpMorse1 = mapTo(Morse, false; β=3, γ=10.0, cf=1.0, averagingLength=-1)[:, 2]
33+ p3 = plot([real.(tmpMorse1) imag.(tmpMorse1)], title = "Morse (β=3, γ=10)", labels = ["real" "imaginary"], ticks = nothing, linewidth = 4)
34+ tmpMorse2 = mapTo(Morse, false; β=1, γ=3.0, cf=1.0, averagingLength=-2)[:, 2]
35+ p4 = plot([real.(tmpMorse2) imag.(tmpMorse2)], title = "Morse (β=1, γ=3)", labels = ["real" "imaginary"], ticks = nothing, linewidth = 4)
36+ p5 = plot(mapTo(dog2; averagingLength = -1.5)[:, 2], title = "derivative of gaussians (dog2)", legend = false, ticks = nothing, linewidth = 5)
37+ p6 = plot(mapTo(cHaar, true; averagingLength = 1)[:, 2], title = "Haar", legend = false, ticks = nothing, linewidth = 5)
38+ p7 = plot(mapTo(cBeyl, true; d = 1, averagingLength = -0)[:, 2], title = "Beylkyin", legend = false, ticks = nothing, linewidth = 5)
39+ p8 = plot(mapTo(cVaid, true; d = 1, averagingLength = -0)[:, 2], title = "Vaidyanathan", legend = false, ticks = nothing, linewidth = 5)
40+ p9 = plot(mapTo(cDb2; d = 1, averagingLength = -0)[:, 2], title = "Daubhechies 2", legend = false, ticks = nothing, linewidth = 5)
41+ p10 = plot(mapTo(cCoif2, true; d = 1, averagingLength = -0)[:, 2], title = "Coiflet 2", legend = false, ticks = nothing, linewidth = 5)
42+ p11 = plot(mapTo(cSym4, true; d = 1, averagingLength = -0)[:, 2], title = "Symlet 4", legend = false, ticks = nothing, linewidth = 5)
43+ k = 0600;
44+ p12 = plot(mapTo(cBatt4, true, 1024-k:1024+k; d = 1, averagingLength = -1)[:, 2], title = "Battle-Lemarie, 4", legend = false, ticks = nothing, linewidth = 5);
45+ plot(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, layout = (3, 4), size = 300 .* (5, 3.2))
3846savefig("mothers.svg")#hide
3947```
4048![ ] ( mothers.svg )
0 commit comments