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

📄 t23zp.m

📁 状态反馈matlab仿真程序
💻 M
字号:
%------------------------------------------------------------------
%  This program is used to solve (ot test) the step response 
%        of UNSTABLE	System by Zero-pole placement
%  NOTE: The 't23k1k2.m' must be executed first.
%------------------------------------------------------------------

Ts=150;
SetValue=1;
Tnoise=Ts+1;
Weight=0;
Anoise=0;
Stime=0;

kosi0=0.7969; omiga0=0.07273; s1=1.8155;
Kp=(b2*omiga0^2+2*kosi0*omiga0*s1*b2-b0)/K;
Ti=(K*Kp)/(b2*s1*omiga0^2);
Td=(2*kosi0*omiga0*b2+b2*s1-b1)/(K*Kp);

af2=K*Kp*Ti*Td;
af1=K*Kp*Ti;
af0=K*Kp;
bt3=Ti*b2;
bt2=Ti*(b1+K*Kp*Td);
bt1=Ti*(b0+K*Kp);
bt0=K*Kp;
[V1,V2,Kop]=tf2zp([af2 af1 af0]/bt3,[bt3,bt2,bt1,bt0]/bt3);

figure(4)
clf;
plot(real(V1(1)),imag(V1(1)),'ro',real(V1(2)),imag(V1(2)),'ro');
plot(real(V2(1)),imag(V2(1)),'r*',real(V2(2)),imag(V2(2)),'r*',...
        real(V2(3)),imag(V2(3)),'r*');
grid on;

% Calaulate the PID parameters
kosi=kosi0-0.3;  omiga=omiga0; s1=1.8155;

figure(5)
clf;
xlabel('t'); ylabel('y'); Title('The Step Response of Unstable System');

for (i=1:1:6)
   
   Kp=(b2*omiga^2+2*kosi*omiga*s1*b2-b0)/K;
   Ti=(K*Kp)/(b2*s1*omiga^2);
   Td=(2*kosi*omiga*b2+b2*s1-b1)/(K*Kp);
   [t,xx,yf]=sim('StatePIDzp',Ts);
   figure(5)
   hold on
   plot(t,yf);
   
   kosi=kosi+0.1;
   %s1=s1+0.04,
   %omiga=omiga-0.02;
   af2=K*Kp*Ti*Td;
   af1=K*Kp*Ti;
   af0=K*Kp;
   bt3=Ti*b2;
   bt2=Ti*(b1+K*Kp*Td);
   bt1=Ti*(b0+K*Kp);
   bt0=K*Kp;
   [V1,V2,Kop]=tf2zp([af2 af1 af0]/bt3,[bt3,bt2,bt1,bt0]/bt3);

   figure(4)
   hold on
   plot(real(V1(1)),imag(V1(1)),'bo',real(V1(2)),imag(V1(2)),'bo');
   plot(real(V2(1)),imag(V2(1)),'b*',real(V2(2)),imag(V2(2)),'b*',...
        real(V2(3)),imag(V2(3)),'b*');
     
end

kosi=kosi0,
Kp=(b2*omiga^2+2*kosi*omiga*s1*b2-b0)/K,
Ti=(K*Kp)/(b2*s1*omiga^2),
Td=(2*kosi*omiga*b2+b2*s1-b1)/(K*Kp),

⌨️ 快捷键说明

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