-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo5.jl
58 lines (43 loc) · 1.54 KB
/
demo5.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
#Demo 5: Generating DataRS & DataHR Datsets
#-------------------------------------------------------------------------------
using CMDimData
using CMDimData.MDDatasets
using CMDimData.EasyPlot
#==Attributes
===============================================================================#
LBL_AXIS_TIME = "Time (s)"
LBL_AXIS_AMPLITUDE = "Amplitude"
#==Input data
===============================================================================#
tfund = 1e-9 #Fundamental
osr = 20 #(fundamental) oversampling ratio
nfund = 20 #cycles of the fundamental
#==Computations
===============================================================================#
t = DataF1(0:(tfund/osr):(nfund*tfund))
#Generate parameter sweeps:
sweeplist = PSweep[
PSweep("period", [1,2,3]*tfund)
PSweep("amp", [1, 1.5, 2])
]
#Generate data:
tonesHR = fill(DataHR{DataF1}, sweeplist) do T, amp
return amp*sin(t*(2pi/T))
end
tonesRS = DataRS(tonesHR)
#==Generate plot
===============================================================================#
plot = cons(:plot, nstrips=2, legend=true,
ystrip1 = set(axislabel=LBL_AXIS_AMPLITUDE, striplabel="DataHR"),
ystrip2 = set(axislabel=LBL_AXIS_AMPLITUDE, striplabel="DataRS"),
xaxis = set(label=LBL_AXIS_TIME),
)
push!(plot,
cons(:wfrm, tonesHR, label="tones", strip=1),
cons(:wfrm, tonesRS, label="tones", strip=2),
)
pcoll = cons(:plot_collection, title="DataHR & DataMD", ncolumns=1)
push!(pcoll, plot)
#==Return pcoll to user (call evalfile(...))
===============================================================================#
pcoll