-
Notifications
You must be signed in to change notification settings - Fork 5
/
sampledata.jl
executable file
·75 lines (62 loc) · 1.9 KB
/
sampledata.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
module sampledata
function genfm(nsamp,wp=1.0,wf=0.01,s=1.0,xend=100*pi)
x=linspace(0.0,xend,nsamp)
y=cos.(wp*x+s*sin.(wf*x))
iw=wp+s*wf*cos.(wf*x)
ynorm=pi/x[end]
return x, y, iw, ynorm
end
function genfmX(nsamp,Fp=1.0,Ff=0.01,amp=0.01,xend=100*pi)
#amp [fm fraction]
x=linspace(0.0,xend,nsamp)
y=cos.(2.0*pi*Fp*x+amp*Fp/Ff*sin.(2.0*pi*Ff*x))
iF=Fp+amp*Fp*cos.(2.0*pi*Ff*x)
ynorm=pi/x[end]
return x, y, iF, ynorm
end
function genlinfm(nsamp,wp=1.0,s=0.01, xend=100*pi)
x=linspace(0.0,xend,nsamp)
y=cos.(wp*x+0.5*s*x.*x)
iw=wp+s*x
ynorm=pi/x[end]
return x, y, iw, ynorm
end
function genstepfm(nsamp=1024,xend=1.0)
x=linspace(0.0,xend,nsamp)
iw=nsamp/4*atan.(250*(x-0.5))+pi*nsamp/4
phase=cumsum(iw)/nsamp
y=cos.(phase)
iy=sin.(phase)*im
ynorm=pi/x[end]
return x, y+iy, iw, ynorm
end
function genmultifm622(nsamp=512)
#Boashash+2015 Example 6.2.2
t=collect(linspace(-1.0,1.0,nsamp))
x=exp.(-t.*t).*(cos.(25.0*pi*t))+cos.(120.0*t.*t.*t+45.0*pi*t)+1.5*exp.(-25.0*t.*t).*cos.(40.0*pi*t.*t+150.0*pi*t)
return t, x
end
function genmultifm622x(nsamp=512)
#Boashash+2015 modified Example 6.2.2
t=collect(linspace(-1.0,1.0,nsamp))
x=exp.(-t.*t).*cos.(25.0*pi*t)+cos.(12.0*t.*t.*t+40.0*pi*t)+1.5*exp.(-25.0*t.*t).*cos.(4.0*pi*t.*t+65.0*pi*t)
return t, x
end
function genmultifm623(nsamp=256)
#Boashash+2015 Example 6.2.3
t=collect(linspace(-1.0,1.0,nsamp))
x=cos.(20.0*sin.(pi*t)+30.0*pi*t)+sin.(20.0*cos.(pi*t)+100.0*pi*t)
return t, x
end
function genmultifm623m(nsamp=256)
t=collect(linspace(-1.0,1.0,nsamp))
x=cos.(40.0*pi*t)+sin.(20.0*cos.(pi*t)+100.0*pi*t)
return t, x
end
function genmultifm623x(nsamp=256)
#Boashash+2015 Example 6.2.3 modified
t=collect(linspace(-1.0,1.0,nsamp))
x=cos.(2.0*sin.(pi*t)+30.0*pi*t)+sin.(2.0*cos.(pi*t)+60.0*pi*t)
return t, x
end
end