%% reachCL_TermRegNonlinSysLinApproach
% computation of the reachable set for
% verifying invariance of the terminal region.
%
%% Syntax
%
% <html>
%        <div class="syntax">
% [Rfin,Rcont] = reachCL_TermRegNonlinSysLinApproach(termReg,sys,input_ff,input2state,opts) <br>
%        </div>
% </html>
%
%% Description
% This function computes the reachable set of the closed-loop
% nonlinear system starting from  the (canidate) terminal region
% under the associated (candidate) safety-preserving controller.
%
%% Input Arguments
%
% <html>
% <table cellspacing="0" cellpadding="4" width="" border="1" frame="box" rules="none" class="">
% <tbody valign="top">
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            termReg
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            candidate terminal region (class: zonotope)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             sys
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            object of class nonlinear system object
%            augmented with generator space for verification
%            (class: nonlinearSys)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             input_ff
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            candidate safety-preserving controller
%            associated with termReg (cell array of zonotopes)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             input2state
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            maps generators of input_ff to generators of
%            termReg and the reachable sets (cell array of;
%            double arrays)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            opts
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            structure containing the algorithm settings, including:
%        </p>
%        <p class="table">
% <table cellspacing="0" cellpadding="4" width="" border="1" frame="box" rules="none" class="inner">
% <tbody valign="top">
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .Ninter
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            number of intermediate time steps
%            [&#123;1&#125; / positive integer]
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .timeStep
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            sampling time [&#123;0.1&#125; / positive scalar]
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .timeStepCtrl
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            sampling time for the contrl inputs
%            [&#123;0.1&#125; / positive scalar]
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .reachOpts
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            structure containing settings for
%            reachability analysis
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .reachParams
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            structure containing parameters for
%            reachability analysis
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .nx
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            dimension of the state space
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .nu
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            dimension of the space of admissible
%            control inputs
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%            .verify
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            settings for verification of the terminal
%            region
%        </p>
%    </td>
%    </tr>
% </tbody>
% </table>
%        </p>
%    </td>
%    </tr>
% </tbody>
% </table>
% </html>
%
%% Output Arguments
%
% <html>
% <table cellspacing="0" cellpadding="4" width="" border="1" frame="box" rules="none" class="">
% <tbody valign="top">
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             Rfin
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            final reachable set after one sampling step
%            (class: polyZonotope)
%        </p>
%    </td>
%    </tr>
%    <tr bgcolor="#F2F2F2">
%    <td>
%        <p class="table">
%             Rcont
%        </p>
%    </td>
%    <td>
%        <p class="table">
%            reachable sets for the time interval [0, timeStep]
%            (class: reachSet)
%        </p>
%    </td>
%    </tr>
% </tbody>
% </table>
% </html>
%
%% References
% [1] L. Schäfer et al. "Scalable Computation of Robust Control
% Invariant Sets of Nonlinear Systems", 2023, IEEE Transactions
% on Automatic Control
%

%%
% <html>
%   <hr>
%   <p class="copy">&copy; 2018-2026 I6 Technische Universit&auml;t M&uuml;nchen
%        <tt class="minicdot">&#149;</tt>
%        <a href="https://tumcps.github.io/AROC/">Website</a>
%        <tt class="minicdot">&#149;</tt>
%        <a href="file:txts/LICENSE.txt">License</a>
%   </p>
% <div>
% <table>
%  <tr>
%   <td style="background-color:#ffffff; border:0; width:25%; vertical-align:middle; text-align:center">
%             <img src="img/logoAroc.png" alt="logoAroc" height="40px">
%      </td>
%   <td style="background-color:#ffffff; border:0; width:25%; vertical-align:middle; text-align:center">
%      <img src="img/logoCora.png" alt="logoCora" height="40px"></td>
%   <td style="background-color:#ffffff; border:0; width:25%; vertical-align:middle; text-align:center">
%      <img src="img/logoChair.png" alt="logoChair" height="40px"></td>
%   <td style="background-color:#ffffff; border:0; width:25%; vertical-align:middle; text-align:center">
%      <img src="img/logoTum.png" alt="logoTum" height="40px"></td>
%  </tr>
% </table>
% </div>
% </html>
