Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 1.82 KB

demo1.md

File metadata and controls

61 lines (48 loc) · 1.82 KB

MDDatasets.jl: demo1.jl

using MDDatasets

Create (x,y) container pair, and call it “x”:

x = DataF1(0:.1:20)
#NOTE: Both x & y coordinates of "x" object initialized as y = x = [supplied range]

“Extract” maximum x-value from data:

xmax = maximum(x)

Construct a normalized ramp dataset, unity_ramp:

unity_ramp = x/xmax

Observe x and unity_ramp

(Note how unity_ramp is normalized such that maximum value is 1)

Compute cos(kx) & ksinkx = cos'(kx):

coskx = cos((2.5pi/10)*x)
ksinkx = deriv(coskx)

Compute ramps with different slopes using unity_ramp (previously computed):

#NOTE: for Inner-most sweep, we need to specify leaf element type (DataF1 here):
ramp = fill(DataRS{DataF1}, PSweep("slope", [0, 0.5, 1, 1.5, 2])) do slope
	return unity_ramp * slope
end

NOTE: the above expression constructs a multi-dimensional DataRS structure, and fills it with (x,y) values for each of the desired parameter values (the slope).

Observe coskx, ksinkx and ramp

Merge two datasets with different # of sweeps (coskx & ramp):

r_cos = coskx+ramp

Observe newly constructed r_cos dataset:

Shift all ramped cos(kx) waveforms to make them centered at their mid-points:

midval = (minimum(ramp) + maximum(ramp)) / 2
c_cos = r_cos - midval #Shift by midval (different for each swept slope of "ramp")

Observe newly constructed c_cos dataset: