-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdemo9.jl
52 lines (41 loc) · 1.32 KB
/
demo9.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
#Demo 9: Waveforms with NaN
#-------------------------------------------------------------------------------
using InspectDR
using Colors
#==Input
===============================================================================#
#Constants
#-------------------------------------------------------------------------------
black = RGB24(0, 0, 0)
white = RGB24(1, 1, 1)
red = RGB24(1, 0, 0)
green = RGB24(0, 1, 0)
blue = RGB24(0, 0, 1)
#Input data
#-------------------------------------------------------------------------------
npts = 1000
T=.1e-6 #Clock period
x = collect(range(0, stop=1e-6, length=npts))
y = sin.(2pi*(x./T))
#Invalidate some data points:
#NOTE: Cannot use F1-acceleration when x has NaN values
x[200] = y[200] = NaN #Causes break
x[460] = NaN
x[505] = NaN
y[580] = NaN
for i in 800:900
y[i] = NaN
end
#==Generate plot
===============================================================================#
mplot = InspectDR.Multiplot(title="Waveforms with NaN")
mplot.layout[:ncolumns] = 1
plot = add(mplot, InspectDR.transientplot(:lin, title="Transient Data",
xlabel="Time (s)", ylabels=["Voltage (V)"])
)
plot.layout[:enable_legend] = false
plot.displayNaN = true #Enable hilighting of NaN values (slower)
wfrm = add(plot, x, y)
wfrm.line = line(color=blue, width=3)
gplot = display(InspectDR.GtkDisplay(), mplot)
:DONE