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

📄 iden_c21.m

📁 状态反馈matlab仿真程序
💻 M
字号:
%-----------------------------------------------------------------------
%           Model Identification Using Relay Feed-back
%-----------------------------------------------------------------------
% Note: This program is available only after the Chap21.mdl is executed 
%                      which output the 'y' value

% Give the value according to the parameters in Chap21.mdl
d=10;
Tal=60;
dm=d/4;

% Plot the Bode Graph of the Real Object
clf
w=logspace(-2,2,200)';
num1=1,den1=[1 3 2],tao1=10,
[r1,i1]=nyquist(num1,den1,w),
rd1=real((r1+j*i1).*exp(-j*w*tao1)),
id1=imag((r1+j*i1).*exp(-j*w*tao1)),
plot(rd1,id1,'r-'),
xlabel('Re'); ylabel('Im'); Title('Nyquist Graph');

% Identification using relay feedback output response
t=[0:0.1:10];
z=step(num1,den1,t);
K=z(100,1);

n=0;
dy=y(2:length(y))-y(1:(length(y)-1));
for m=2:1:(length(dy)-1)
   if (dy(m-1)*dy(m)<0 & abs(y(m))>dm)  % 'dm' is cariable with 'd'
      n=n+1;
      ym(n)=y(m);
      tm(n)=m;
   end
end

T0=Tal*(tm(n)-tm(n-2))/(length(y)-1);  % Tal must be same as the time in Chap21
w0=2*pi/T0;
a=abs(ym(n));
A=(pi*a)/(4*d);            % 'd' is variable
T=sqrt((K/A)^2-1)/w0;
tao2=(pi-atan(w0*T))/w0;
num2=K;
den2=[T 1];

% Plot the Bode Graph of the Identified Model
hold on;
[r2,i2]=nyquist(num2,den2,w),
rd2=real((r2+j*i2).*exp(-j*w*tao2)),
id2=imag((r2+j*i2).*exp(-j*w*tao2)),
plot(rd2,id2,'b:'),

% Plot the graph of the output value
figure(2);
t=[0:Tal/(length(y)-1):Tal];
plot(t,y); grid,
xlabel('t'); ylabel('y'); Title('Output Oscillation Curve');

⌨️ 快捷键说明

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