Condition_Linear class
Contents
Description
This is a sub-class of the Condition class for the implementation of Linear conditions.
In a given time t, a linear condition value y is obtained as:
Where:
: Value at initial time
: Time rate of change
: Initial time (when condition is activated)
classdef Condition_Linear < Condition
Public properties
properties (SetAccess = public, GetAccess = public) init_value double = double.empty; % initial condition value when activated slope double = double.empty; % rate of change of prescribed condition value end
Constructor method
methods function this = Condition_Linear() this = this@Condition(Condition.LINEAR); this.setDefaultProps(); end end
Public methods: implementation of super-class declarations
methods %------------------------------------------------------------------ function setDefaultProps(this) this.init_value = 0; this.slope = 0; end %------------------------------------------------------------------ function val = getValue(this,time) val = deal(this.init_value) + this.slope * (time-this.init_time); end end
end