psim_lin.m

来自「一个matlab的将军模型」· M 代码 · 共 49 行

M
49
字号
function R = psim_lin(A,b,X0,T,N)

% Compute flow pipe approximations for the `linear` (affine) dynamics
% "dx/dt = A*x + b".
%
% Syntax:
%   "R = psim_lin(A,b,X0,T,N)"
%
% Description:
%   The inputs are
%
%   * "A": the system matrix
%
%   * "b": constant input vector for the affine dynamics
%
%   * "X0": a "linearcon" object represeting the initial set
%
%   * "T": time step for the flow pipe approximation
%
%   * "N": number of steps (flow pipe segments) to compute
%
%   The output "R" is a cell array of "linearcon" objects, each representing
%   an approximation to a flow pipe segments.
%
% See Also:
%   fs_lin_map,seg_approx_lin,step_response,stretch_func_lin,linearcon,
%   transform

% If a is invertible, precompute its inverse
if rank(A) == size(A,1)
  Ainv = inv(A);
else
  Ainv = [];
end

if N < 1
  return
end

R = {};
SP0 = vertices(X0);
% approximate the first segment from t = 0 to t = T
R{1} = seg_approx_lin(A,Ainv,b,X0,SP0,T);
eAT = expm(A*T);
displacement = step_response(A,Ainv,b,T);
% apply affine transformation to obtain the rest of the segments
for k = 2:N
  R{k} = transform(R{k-1},eAT,displacement);
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?