Im trying to run reach on a nonlinear hybrid automaton, but i receive a matrix dimension error in the abstractionError_adaptive function.
% Dynamics
pke = nonlinearSys(@pke,4,0);
% Invariant set
inv = polytope([-1,0,0,0; 0,-1,0,0; 0,0,-1,0; 0,0,0,-1],[0;0;0;-1]); % n>=0, C1>=0, Trx>=0, rhoc>=-1
%%
% Locations/ nodes
guard1 = conHyperplane([0,0,-1,0],675); % transition to 2 when Trx >= 675
reset1.f = @(x,u)([x(1); x(2); x(3); 0.66 + 1.2*(675-x(3))]);
trans1 = transition(guard1,reset1,2); % --> next loc: 2
loc(1) = location('startup',inv,trans1,pke); % startup
guard2 = conHyperplane([0,0,-1,0],810); % transition to 3 when Trx >= 1.2*675
reset2.f = @(x,u)([x(1); x(2); x(3); -1]);
trans2 = transition(guard2,reset2,3); % --> next loc: 3
loc(2) = location('steadystate',inv,trans2,pke); % steady state
guard3 = conHyperplane([0,0,1,0],650); % transition to 1 when Trx <= 650
reset3.f = @(x,u)([x(1); x(2); x(3); 0.7]);
trans3 = transition(guard3,reset3,1); % --> next loc: 1
loc(3) = location('scram',inv,trans3,pke); % SCRAM
HA = hybridAutomaton(loc);
%% Reachability
clc
% Parameters --------------------------------------------------------------
params.tFinal = 400;
params.R0 = zonotope([[0; 0.0012; 650; 0.7], diag([0,0,0,0])]);
params.startLoc = 1;
parama.U = zonotope(0,0);
% Reachability Settings ---------------------------------------------------
options.timeStep = 1;
options.taylorTerms = 10;
options.zonotopeOrder = 50;
options.alg = 'lin-adaptive';
options.tensorOrder = 2;
options.lagrangeRem.simplify = 'simplify';
% settings for hybrid systems
options.guardIntersect = ['polytope'];
options.enclose = {'box'};
% Reachability Analysis ---------------------------------------------------
tic
R = reach(HA, params, options);
tComp = toc;
disp(['computation time of reachable set: ',num2str(tComp)]);
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise
multiplication, use '.*'.
Error in abstractionError_adaptive (line 101)
err(i,1) = 0.5 * dz' * options.hessianConst{i} * dz;
Error in nonlinearSys/linReach_adaptive>aux_initStepTensorOrder (line 419)
[~,~,L0_2,options] = abstractionError_adaptive(obj,options,Rdelta);
Error in nonlinearSys/linReach_adaptive (line 98)
options = aux_initStepTensorOrder(obj,options,Rstart);
Error in nonlinearSys/reach_adaptive (line 85)
[Rnext.ti,Rnext.tp,options] = linReach_adaptive(obj,options,options.R);
Error in contDynamics/reach (line 68)
[timeInt,timePoint,res,~,options] = reach_adaptive(obj,params,options);
Error in location/reach (line 56)
R = reach(loc.contDynamics,params,options_,spec);
Error in hybridAutomaton/reach (line 136)
[Rtemp,Rjump,res] = reach(HA.location(locID),R0,tStart,options);
Error in reactor_HA (line 53)
R = reach(HA, params, options);
Related documentation