% Parameter ---------------------------------------------------------------
params.R0 = zonotope([1;0],diag([0.05,0.05])); % initial set
params.startLoc = 1; % initial location
params.tFinal = 1.7; % final time
% Reachability Options ----------------------------------------------------
% settings for continuous reachability
options.taylorTerms = 10;
options.zonotopeOrder = 20;
% settings for hybrid systems
options.guardIntersect = 'polytope';
options.enclose = {'box'};
% Hybrid Automaton --------------------------------------------------------
linSys = linearSys('linearSys',A,B,c);
alpha = -0.75; % rebound factor
inv = polytope([-1,0],0);
guard = polytope([0,1],0,[1,0],0);
reset = linearReset([0, 0; 0, alpha],[],zeros(2,1));
trans = transition(guard,reset,1);
loc = location('loc1',inv,trans,linSys);
HA = hybridAutomaton(loc);
% Reachability Analysis ---------------------------------------------------
R = reach(HA,params,options);
% Simulation --------------------------------------------------------------
simRes = simulateRandom(HA,params);
% Visualization -----------------------------------------------------------
useCORAcolors("CORA:contDynamics")
plotOverTime(R,1,'DisplayName','Reachable set');
plotOverTime(R(1).R0,1,'HandleVisibility','off');
% plot simulated trajectories
plotOverTime(simRes,1,'DisplayName','Simulations');