1 非线性系统反馈线性化
反馈线性化的步骤:
(1)目标线性系统
(2)线性化系统镇定
(3)从非线性系统到线性化系统---反馈线性化
2 搭建仿真系统
MATLAB Function程序
%系统
function fx = fcn(dy,y)
fx = sin(y)+exp(dy)+2*y*dy;
%controller
function u = fcn(dy,y)
k1 = -9;
k2 = -6;
u0 = k1*y + k2*dy;
u = ( u0 - sin(y) - exp(dy) - 2*y*dy )/4;
3 仿真结果
3.1 变步长仿真
可以发现,采用变步长仿真出来的图像更为有些不光滑。
3.2 定步长仿真
可以发现,采用定步长仿真出来的图像更为光滑。
4 扩张状态观测器
在实际情况中,系统的状态(如,即)有时候是不可获得的,此时就需要设计(扩张)状态观测器类进估计系统的状态。
4.1 设计扩张状态观测器
二阶系统
,其中。
定义,,则有
系统的初始状态,。
定义新的状态,其一阶导数。
则扩张后状态系统变为:
设计线性扩张状态观测器如下形式:
线性扩张状态观测器系统的初始状态,,。
4.2 仿真模型搭建
4.3 仿真结果
系统状态x1和x2
4.4 matlab程序
%%参数para_02.matlab
%线性扩张状态观测器增益
para.beta1=100;
para.beta2=2500;
para.beta3=2500;
para.b=4
%%系统SYS.matlab
%MATLAB Function
function fx = fcn(dy,y)
fx = sin(y)+exp(dy)+2*y*dy;
%%控制器设计controller.matlab
%controller
function u = fcn(y_hat,dy_hat)
k1 = -9;
k2 = -6;
u0 = k1*y_hat + k2*dy_hat;
u = ( u0 - sin(y_hat) - exp(dy_hat) - 2*y_hat*dy_hat )/4;
%%线性扩张状态观测器LSO_02.matlab
%LESO
function [sys,x0,str,ts,simStateCompliance] = LESO_02(t,x,u,flag,para)
% The following outlines the general structure of an S-function.
%
switch flag,
%%%%%%%%%%%%%%%%%%
% Initialization %
%%%%%%%%%%%%%%%%%%
case 0,
[sys,x0,str,ts,simStateCompliance]=mdlInitializeSizes;
%%%%%%%%%%%%%%%
% Derivatives %
%%%%%%%%%%%%%%%
case 1,
sys=mdlDerivatives(t,x,u,para);
%%%%%%%%%%
% Update %
%%%%%%%%%%
case 2,
sys=mdlUpdate(t,x,u);
%%%%%%%%%%%
% Outputs %
%%%%%%%%%%%
case 3,
sys=mdlOutputs(t,x,u);
%%%%%%%%%%%%%%%%%%%%%%%
% GetTimeOfNextVarHit %
%%%%%%%%%%%%%%%%%%%%%%%
case 4,
sys=mdlGetTimeOfNextVarHit(t,x,u);
%%%%%%%%%%%%%
% Terminate %
%%%%%%%%%%%%%
case 9,
sys=mdlTerminate(t,x,u);
%%%%%%%%%%%%%%%%%%%%
% Unexpected flags %
%%%%%%%%%%%%%%%%%%%%
otherwise
DAStudio.error('Simulink:blocks:unhandledFlag', num2str(flag));
end
% end sfuntmpl
%
%=============================================================================
% mdlInitializeSizes
% Return the sizes, initial conditions, and sample times for the S-function.
%=============================================================================
%
function [sys,x0,str,ts,simStateCompliance]=mdlInitializeSizes
% call simsizes for a sizes structure, fill it in and convert it to a
% sizes array.
%
% Note that in this example, the values are hard coded. This is not a
% recommended practice as the characteristics of the block are typically
% defined by the S-function parameters.
%
sizes = simsizes;
sizes.NumContStates = 3;
sizes.NumDiscStates = 0;
sizes.NumOutputs = 3;
sizes.NumInputs = 2;
sizes.DirFeedthrough = 0;
sizes.NumSampleTimes = 1; % at least one sample time is needed
sys = simsizes(sizes);
% initialize the initial conditions
%
x0 = [0.8;1.8;1];
% str is always an empty matrix
%
str = [];
% initialize the array of sample times
%
ts = [0 0];
% Specify the block simStateCompliance. The allowed values are:
% 'UnknownSimState', < The default setting; warn and assume DefaultSimState
% 'DefaultSimState', < Same sim state as a built-in block
% 'HasNoSimState', < No sim state
% 'DisallowSimState' < Error out when saving or restoring the model sim state
simStateCompliance = 'UnknownSimState';
% end mdlInitializeSizes
%=============================================================================
% mdlDerivatives
% Return the derivatives for the continuous states.
%=============================================================================
%
function sys=mdlDerivatives(t,x,u,para)
beta1=para.beta1;
beta2=para.beta2;
beta3=para.beta3;
uc=u(1);
x1=u(2);
z1=x(1);
z2=x(2);
z3=x(3);
e=z1-x1;
dz1=z2-beta1*e;
dz2=z2-beta2*e;
dz3=-beta3*e;
sys = [dz1;dz2;dz3];
% end mdlDerivatives
%=============================================================================
% mdlUpdate
% Handle discrete state updates, sample time hits, and major time step
% requirements.
%=============================================================================
%
function sys=mdlUpdate(t,x,u)
sys = [];
% end mdlUpdate
%=============================================================================
% mdlOutputs
% Return the block outputs.
%=============================================================================
%
function sys=mdlOutputs(t,x,u)
sys = [x];
% end mdlOutputs
%=============================================================================
% mdlGetTimeOfNextVarHit
% Return the time of the next hit for this block. Note that the result is
% absolute time. Note that this function is only used when you specify a
% variable discrete-time sample time [-2 0] in the sample time array in
% mdlInitializeSizes.
%=============================================================================
%
function sys=mdlGetTimeOfNextVarHit(t,x,u)
sampleTime = 1; % Example, set the next hit to be one second later.
sys = t + sampleTime;
% end mdlGetTimeOfNextVarHit
%=============================================================================
% mdlTerminate
% Perform any end of simulation tasks.
%=============================================================================
%
function sys=mdlTerminate(t,x,u)
sys = [];
% end mdlTerminate