classdef SwitchBetweenStableMLF < HybridSystem % Define the switched system as a subclass of HybridSystem. properties % Define variable class properties. ... end properties(SetAccess = immutable) % Define constant (i.e., "immutable") class properties. A1 = [-0.1, -1; 2, -0.1]; A2 = [-0.1, -2; 1, -0.1]; end methods % Define functions, including definitions of f, g, C, and D. function xdot = flowMap(this, x, ~, ~) y = x(1:2); q = x(3); A1 = this.A1; A2 = this.A2; if q == 1 ydot = A1*y; elseif q == 2 ydot = A2*y; end xdot = [ydot; 0]; end function xplus = jumpMap(this, x) q = x(3); qplus = 3-q; xplus = [x(1:2); qplus]; end function inC = flowSetIndicator(~, x) q = x(3); inC = (q==1 && x(1)>=0) || (q==2 && x(1)<0); end function inD = jumpSetIndicator(~, x) q = x(3); inD = (q==1 && x(1)<0) || (q==2 && x(1)>=0); end end end