ConstantWave#
- class ConstantWave(options)#
Bases:
PeriodicWaveform,ConstantTopConstantWavegenerates a constant (DC) waveform.Creates a waveform with a constant amplitude value over the specified duration. Inherits from
PeriodicWaveformandConstantTopfor periodic behavior and constant amplitude properties.Example1:
% Basic constant waveform const = ConstantWave(amplitude = 5.0, duration = 0.01); const.plot();
Example2:
% Constant waveform with offset const = ConstantWave(amplitude = 2.0, offset = 1.0, duration = 0.005); const.plot();
- Constructor Summary
- ConstantWave(options)#
Construct a ConstantWave object.
- Parameters:
samplingRate (
double, optional) – Sampling rate in Hz (default: [])startTime (
double, optional) – Start time in seconds (default: 0)duration (
double, optional) – Duration in seconds (default: [])offset (
double, optional) – DC offset value (default: 0)
- Method Summary
- TimeFunc()#
Get the time function for the constant waveform.
Returns a function handle that generates a constant value over the specified duration, zero outside the duration. Implements the abstract
TimeFunc()method fromWaveform.- Returns:
Function that takes time array and returns constant values
- Return type:
function_handle
Example:
const = ConstantWave(amplitude = 2.0, duration = 0.01); func = const.TimeFunc(); t = 0:0.001:0.02; y = func(t);