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

📄 t23k1k2.m

📁 状态反馈matlab仿真程序
💻 M
字号:
%------------------------------------------------------------------
%  This program is used to solve (ot test) the step response 
%        of Unstable System by Zero-pole placement
%%------------------------------------------------------------------

clear all; clf;
 
num1=[1];den1=[1 -1];tao1=8;
K=-1; T=-1; tao3=tao1;

% Calculate the Bode Graph of the Real Object
w=logspace(-2,2,200)';
[r1,i1]=nyquist(num1,den1,w);
rd1=real((r1+j*i1).*exp(-j*w*tao1));
id1=imag((r1+j*i1).*exp(-j*w*tao1));

% Calculate the coefficient fo the state feed back
N=1;
l0=1;
for (i=1:1:N)
   l(i)=tao3^i/fac(i);
end
InnerOmiga0=sqrt(0.1967);  % The ideal model
aop1=1.9222/InnerOmiga0;   % The ideal model
printsys([1],[1 aop1*InnerOmiga0 InnerOmiga0^2])
k0(2)=(aop1*InnerOmiga0*T-l0*T/l(1)-1)/K,
k0(1)=(InnerOmiga0^2*l(1)*T-K*k0(2)*l0-l0)/K,

% The Influence of k1 & k2 on the Inner Loop

% k(1)=-1.0 ~ 1.5
% k(2)=-2 ~ 100
figure(1)
k=[k0(1)-0.2 k0(2)];
for (i=1:1:5)
   [t,xx,y]=sim('Statefeedback',50);
   plot(t,y),
   hold on
   k(1)=k(1)+0.3;
end
xlabel('t'); ylabel('y'); 
Title('The Influence of k1 on the Inner Loop');

figure(2)
k=[k0(1) k0(2)-0.2];
for (i=1:1:5)
   [t,xx,y]=sim('StateFeedback',50);
   plot(t,y),
   hold on
   k(2)=k(2)+1;
end
xlabel('t'); ylabel('y'); 
Title('The Influence of k2 on the Inner Loop');

% Restore the k1 & k2 
k=k0;

b2=l(1)*T;
b1=l(1)+K*k(2)*l(1)+T*l0;
b0=l0+K*k(2)*l0+K*k(1);
num2=[K/b2];
den2=[1 b1/b2 b0/b2];
printsys(num2,den2);
roots(den2);
[rd2,id2]=nyquist(num2,den2,w);

% Plot the Nyquist graph
figure(3)
plot(rd1(1:(length(rd1)-75)),id1(1:(length(rd1)-75)),'r-'),
hold on
plot(rd2(1:(length(rd2))),id2(1:(length(rd2))),'b:'),
grid on
xlabel('Re'); ylabel('Im'); Title('Nyquist Curve');


⌨️ 快捷键说明

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