Waveform

Waveform#

class Waveform#

Bases: handle

Waveform generates and stores waveforms for experimental control.

A waveform can represent either a continuous function of time or a discrete time-sequence of samples. The definition is given by TimeFunc(), which returns a function handle mapping time \(t\) to the waveform value.

The waveform samples are calculated lazily when Sample is accessed, based on TimeFunc() and timing parameters (StartTime, Duration, SamplingRate).

Example1:

% Create a sine wave
sine = SineWave(frequency = 1000, amplitude = 1.0, duration = 0.01);
samples = sine.Sample;  % Get waveform samples
sine.plot();            % Plot the waveform

Example2:

% Create a constant waveform
const = ConstantWave(amplitude = 5.0, duration = 0.005);
const.plot();
Constructor Summary
Waveform()#

Construct an instance of Waveform.

Property Summary
Duration double {mustBeNonnegative} = 0.1#

Duration \(T\) [s]

EndTime#

\(t_\mathrm{end} =\) StartTime + Duration [s]

NSample#

Number of samples derived from SamplingRate and Duration

Sample#

Samples constructed by evaluating TimeFunc() on [StartTime, EndTime]

SamplingRate double {mustBePositive} = 1#

Sampling rate [Hz]

Scan = table(string.empty,string.empty,'VariableNames',{'ParameterName','VariableName'})#

Parameter scan table for control panels

StartTime double = 0#

Start time \(t_0\) [s]

TimeStep#

\(\Delta t = 1/\) SamplingRate [s]

Method Summary
convert2Table()#

Get a table representation of waveform parameters for UI/database.

Collects configurable properties, applies scan mappings if present, and returns a compact table for storage or display.

Returns:

Table with columns: Type, SamplingRate, Parameter, and optionally modulation IDs

Return type:

table

plot()#

Plot waveform samples versus time with LaTeX-formatted labels.

Example:

sine = SineWave(frequency = 1000, amplitude = 1.0);
sine.plot();