1 理论框架
2 一阶系统描述
3 二阶系统描述
对于上述状态及扰动项的估计,参考状态观测器的设计内容。
4 仿真实例
5 仿真结果
相关参数matlab中均已给出。
仿真分别采用了线性扩张状态观测器(LESO)和非线性扩张状态观测器(NLESO)进行的。结果如下:
Ⅰ:NLESO仿真结果
参数:。
Ⅱ:LESO仿真结果
参数:
6 代码
LESO
%ESO观测器程序
clear all;
h=0.01; %采样时间
T=0.01;
time = 20;
N = time/T; %仿真步数
n=0:N-1;
% x = sin(n*T);
for k=1:1:N
% original state
x1(1) = 0.3;
x2(1) = 0.3;
x3(1) = 0.3;%新的扰动初始状态
x1(k+1) = x1(k) + h*x2(k);
x2(k+1) = x2(k) + h*(-(1+0.5*cos(k*T))*x1(k)-(1+sin(k*T/3))*x2(k)+sign(sin(1.5*k*T)));
x3(k+1) = -(1+0.5*cos(k*T))*x1(k)-(1+sin(k*T/3))*x2(k)+sign(sin(1.5*k*T));%新的扰动状态
y(k) = x1(k);
% state observer
z1(1) = 0.2;
z2(1) = 0.2;
z3(1) = 0.2;
e(k) = z1(k) - y(k);
%LESO
z1(k+1) = z1(k) + h*(z2(k)-100*e(k));
z2(k+1) = z2(k) + h*(z3(k)-2500*e(k));
z3(k+1) = - h*2500*e(k);
end
% 估计值与实际值对比
figure
plot(n*T,x1(1,1:N),'b+',n*T,z1(1,1:N),'r.');
legend('x1','z1');
figure
plot(n*T,x2(1,1:N),'b+',n*T,z2(1,1:N),'r.');
legend('x2','z2');
figure
plot(n*T,x2(1,1:N),'b+',n*T,z2(1,1:N),'r.');
legend('x3','z3');
% 估计值与实际值的误差分析
figure
plot(n*T,x1(1,1:N)-z1(1,1:N),'b--');
legend('error1=x1-z1');
figure
plot(n*T,x2(1,1:N)-z2(1,1:N),'b--');
legend('error2=x2-z2');
figure
plot(n*T,x3(1,1:N)-z3(1,1:N),'b--');
legend('error3=x3-z3');
NLESO
%ESO观测器程序
clear all;
h=0.01; %采样时间
T=0.01;
time = 20;
N = time/T; %仿真步数
n=0:N-1;
% x = sin(n*T);
for k=1:1:N
% original state
x1(1) = 0.3;
x2(1) = 0.3;
x3(1) = 0.3;%新的扰动初始状态
x1(k+1) = x1(k) + h*x2(k);
x2(k+1) = x2(k) + h*(-(1+0.5*cos(k*T))*x1(k)-(1+sin(k*T/3))*x2(k)+sign(sin(1.5*k*T)));
x3(k+1) = -(1+0.5*cos(k*T))*x1(k)-(1+sin(k*T/3))*x2(k)+sign(sin(1.5*k*T));%新的扰动状态
y(k) = x1(k);
% state observer
z1(1) = 0.2;
z2(1) = 0.2;
z3(1) = 0.2;
e(k) = z1(k) - y(k);
%NLESO
fe = fal(e(k), 0.5, 0.01);
z1(k+1) = z1(k) + h*(z2(k)-100*e(k));
z2(k+1) = z2(k) + h*(z3(k)-500*fe);
z3(k+1) = - h*1000*fe;
end
% 估计值与实际值对比
figure
plot(n*T,x1(1,1:N),'b+',n*T,z1(1,1:N),'r.');
legend('x1','z1');
figure
plot(n*T,x2(1,1:N),'b+',n*T,z2(1,1:N),'r.');
legend('x2','z2');
figure
plot(n*T,x2(1,1:N),'b+',n*T,z2(1,1:N),'r.');
legend('x3','z3');
% 估计值与实际值的误差分析
figure
plot(n*T,x1(1,1:N)-z1(1,1:N),'b--');
legend('error1=x1-z1');
figure
plot(n*T,x2(1,1:N)-z2(1,1:N),'b--');
legend('error2=x2-z2');
figure
plot(n*T,x3(1,1:N)-z3(1,1:N),'b--');
legend('error3=x3-z3');