classdef MyBouncingBall < HybridSystem % Define bouncing ball system as a subclass of HybridSystem. properties % Define variable class properties. ... end properties(SetAccess = immutable) % Define constant (i.e., "immutable") class properties. gamma = 9.81; lambda = 0.7; end methods % Define functions, including definitions of f, g, C, and D. function xdot = flowMap(this, x, ~, ~) v = x(2); xdot = [v; -this.gamma]; end function xplus = jumpMap(this, x) h = x(1); v = x(2); xplus = [h; -this.lambda*v]; end function inC = flowSetIndicator(~, x) h = x(1); v = x(2); inC = (h >= 0) || (v >= 0); end function inD = jumpSetIndicator(~, x) h = x(1); v = x(2); inD = (h <= 0) && (v <= 0); end end end