function [states,q,qa,transitions,I,U,configuration] = nplatoon
% n-Platoon


        n=10; %  1 Lead + n vehicle

        ns=3*n; % # states
        nu=n;   % # inputs
        ny=ns; % # meas.

        Ti=0.5;
        Ai0=[0,1,0;...
            0,0,-1;...
            0,0,-1/Ti];
        Ai1=[0,0,0;...
            0,0,1;...
            0,0,0];
        Bi=[0;0;1/Ti];
        B0=[0;1;0];

        % Compute state space model
        A=zeros(ns,ns);
        B2=zeros(ns,n);
        B1=zeros(ns,1); % Bw
        B1(1:3,1)=B0; % Bw
        %
        A(1:3,1:3)=Ai0;
        B2(1:3,1)=Bi;
        for i=2:n
            A(3*(i-1)+1:3*i,3*(i-1)+1:3*i)=Ai0;
            A(3*(i-1)+1:3*i,3*(i-2)+1:3*(i-1))=Ai1;
            B2(3*(i-1)+1:3*i,i)=Bi;% Bu
        end

        Q=1e0*eye(ns,ns);
        [~,~,K,~] = care(A,B2,Q);
        % Closed loop state feedback
        Acl=A-B2*K;
        
        % definition of locations -----------------------------------------
        % continuous dynamics in each state
        states{1}.A = Acl;
        states{1}.B = B1;
        
        q=[1]; % discrete states 
        qa=1; % initial mode
        
        % definition of transitions ---------------------------------------
        transitions = []; % no transitions
        
        % initial values --------------------------------------------------
        % initial set (as polyheder)
        I.polyheder.C = vectorgenerator(ns) ;
        I.polyheder.d = zeros(2*size(I.polyheder.C,2),1);

        % input set (as box)
        U.polyheder.C = vectorgenerator(1);
        U.polyheder.d = [1; 9];
        
        % configuration parameters ----------------------------------------
        configuration.timehorizon = 30; % time horizon
        configuration.timestep = 0.1; % timestep