In [1]:
VERSION
Out[1]:
In [2]:
using PyPlot
import DSP
In [3]:
include("../juwvid.jl")
Out[3]:
In [4]:
# multicomponent data (Boashash+15,p346,Example 6.2.2)
nsample=1024
t,x=sampledata.genmultifm622(nsample);
fig=PyPlot.figure(figsize=(10,3))
PyPlot.plot(t,x)
PyPlot.xlabel("t")
PyPlot.ylabel("y")
PyPlot.savefig("triple.png")
#writedlm("mf622.txt",[t x])
In [5]:
# STFT
tfrstft=stft.tfrstft(x,NaN,NaN,NaN,NaN,NaN,4);
In [6]:
# pseudo Wigner Ville
z=DSP.Util.hilbert(x);
tfr=cohenclass.tfrpwv(z);
In [7]:
# S-method (constant Lp=6)
sm1=smethod.tfrsm(x,NaN,6,NaN,4);
In [8]:
#frequency width
2*6/nsample/(t[2]-t[1])/2
Out[8]:
In [9]:
# S-method (constant Lp=15)
sm2=smethod.tfrsm(x,NaN,15,NaN,4);
In [10]:
fig=PyPlot.figure()
ax = fig[:add_subplot](2,2,1)
a=juwplot.tfrshow(abs.(tfr),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2,"CMRmap")
PyPlot.title("pseudo Wigner Ville")
PyPlot.ylabel("frequency")
PyPlot.ylim(0,120)
ax = fig[:add_subplot](2,2,2)
a=juwplot.wtfrshow(abs.(sm2),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2,"CMRmap")
PyPlot.title("S-method (Lp=15)")
PyPlot.ylim(0,120)
ax = fig[:add_subplot](2,2,3)
a=juwplot.wtfrshow(abs.(sm1),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2,"CMRmap")
PyPlot.title("S-method (Lp=6)")
PyPlot.xlabel("time")
PyPlot.ylabel("frequency")
PyPlot.ylim(0,120)
ax = fig[:add_subplot](2,2,4)
a=juwplot.wtfrshow(abs.(tfrstft).^2,t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2,"CMRmap")
PyPlot.title("Spectrogram")
PyPlot.xlabel("time")
PyPlot.ylim(0,120)
Out[10]:
In [11]:
# Alias-free PWV = SM for Lp=N/2
trfafwv=smethod.tfrsm(x,NaN,floor(Int,nsample/2),NaN,4);
In [12]:
a=juwplot.wtfrshow(abs.(trfafwv),t[2]-t[1],t[1],t[end],NaN,NaN,0.7*2,"CMRmap",0,600)
PyPlot.colorbar(a,shrink=0.7)
PyPlot.ylim(0,120)
Out[12]:
In [ ]: