TUMcps / CORA

Toolbox for Reachability Analysis
GNU General Public License v3.0
108 stars 35 forks source link

Error in intervalMultiplication while using reach function for linear system #34

Closed GillesDel closed 2 years ago

GillesDel commented 2 years ago

Hello, I am getting a dimension error while using the reach function for a linear system, without having any error in previous function for the system definition. Here is the error and my code (I tried different examples that works perfectly) :

_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 zonotope/intervalMultiplication (line 47) Z.Z = [0center(Z),diag(SZabssum)];

Error in * (line 42) res = intervalMultiplication(factor2,factor1);

Error in reach_adaptive>initTimeStep (line 443) Etu = obj.taylor.error options.timeStep options.U;

Error in reach_adaptive (line 97) options = initTimeStep(obj,options);

Error in linearSys/reach (line 62) [Rout,Rout_tp,res,deltaT] = reach_adaptive(obj, options);

Error in Example_FullAlgo (line 34) Rf = reach(sysf,params,options);

The code :

`% system definition A = [zeros(6,6) eye(6,6); zeros(1,4) 2 zeros(1,7); zeros(1,3) -5 zeros(1,8); zeros(4,12);]; % size 12x12 B = [zeros(8,4); diag([1/0.063 1/0.582857e-4 1/0.716914e-4 1/1e-4])]; % size 12x4

% zonotopes definition x = [1 1 1, 0.01 0.02 0.5, 0.02 0.03 -0.05, 0.02 0.03 -0.05]'; %size 1x12 genx = 0.1*eye(12,12); %size 12x12 u = [1;0;0;0]; %size 1x4 genu = diag([1 0.1 0.1 0.1]); %size 4x4 Zx = conZonotope(x,genx,[],[]); Zu = zonotope(u,genu); sysf = linearSys(A, B);

% Parameters and options clear params options options.linAlg = 'adaptive'; options.error = 0.1; options.verbose = true;

params.tFinal = 1; params.R0 = Zx; params.U = Zu;

Rf = reach(sysf,params,options);`

wetzlingerm commented 2 years ago

Hello, thanks for catching this error. It has been fixed in the last commit. Please note that the reach-algorithm for the linearSys class with linAlg = 'adaptive' only works for zonotopes as initial sets (you have defined a conZonotope object).