⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chap7_16.m

📁 该程序是由matlab语言针对<先进PID控制及其MATLAB仿真>编写的,希望对大家有用.
💻 M
字号:
%Adaptive Robust Control Based on PD Term
clear all;
close all;
global S

ts=0.001;
TimeSet=[0:ts:60];

a0=30;
a1=20;
b=50;

Am=[0,1;-a0,-a1];
eig(Am)
%Q=[20,0;0,20];
Q=[20,10;10,20];

P=lyap(Am',Q);
p12=P(1,2);
p22=P(2,2);
para=[a1,a0,b,p12,p22];

[t,yout]=ode45('chap7_16eq',TimeSet,[0 0 0 0 0 0 0],[],para);
k0=yout(:,5);
k1=yout(:,6);
k2=yout(:,7);

switch S
case 1
   r=1.0*sign(sin(0.05*t*2*pi));    %Square Signal
case 2
   r=1.0*sin(1.0*t*2*pi);           %Sin Signal
end
u=k0.*r+k1.*yout(:,3)+k2.*yout(:,4);

figure(1);
plot(t,yout(:,1),'k',t,yout(:,3),'k');
xlabel('Time(s)');ylabel('Position tracking');

figure(2);
plot(t,yout(:,1)-yout(:,3),'k');
xlabel('Time(s)');ylabel('Position tracking error');

figure(3);
plot(t,u,'k');
xlabel('Time(s)');ylabel('Control input');

figure(4);
subplot(3,1,1);
plot(t,k0,'k');
xlabel('Time(s)');ylabel('k0');
subplot(3,1,2);
plot(t,k1,'k');
xlabel('Time(s)');ylabel('k1');
subplot(3,1,3);
plot(t,k2,'k');
xlabel('Time(s)');ylabel('k2');

⌨️ 快捷键说明

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