Condition_Oscillatory class
Contents
Description
This is a sub-class of the Condition class for the implementation of Oscillatory conditions.
In a given time t, an oscillatory condition value y is obtained as:

Where:
: Base value for oscillation
: Oscillation amplitude around base value
: Oscillation period
: Oscillation phase shift
: Initial time (when condition is activated)
classdef Condition_Oscillatory < Condition
Public properties
properties (SetAccess = public, GetAccess = public)
base_value double = double.empty; % base condition value for oscillation
amplitude double = double.empty; % amplitude of oscillation around base value
period double = double.empty; % period of oscillation
shift double = double.empty; % shift from initial point of oscillation (phase angle)
end
Constructor method
methods
function this = Condition_Oscillatory()
this = this@Condition(Condition.OSCILLATORY);
this.setDefaultProps();
end
end
Public methods: implementation of super-class declarations
methods
%------------------------------------------------------------------
function setDefaultProps(this)
this.base_value = 0;
this.amplitude = 0;
this.period = inf;
this.shift = 0;
end
%------------------------------------------------------------------
function val = getValue(this,time)
val = this.base_value + this.amplitude * sin(2*pi*(time-this.init_time)/this.period + this.shift);
end
end
end