900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > matlab 中带迟延环节的开环传递函数来获得其闭环传递函数

matlab 中带迟延环节的开环传递函数来获得其闭环传递函数

时间:2020-11-30 01:16:37

相关推荐

matlab 中带迟延环节的开环传递函数来获得其闭环传递函数

采用PADE函数,有理函数来近似

%PID 带滞后的传递函数,not use feedback,but pade

%将迟延环节表示成一个多项式,有理函数来近似

% 传递函数为G(s)=2*e^(-0.5s)/(2s+1),

clc

clear all

close all

num=[0 2];

den=[2 1];

delay=0.5;

%T为延迟时间常数,n为要求拟合的阶数

[n2,d2]=pade(delay,2)

num2=conv(num,n2);

den2=conv(den,d2);

disp('object tranfer function')

G_obj=tf(num2,den2)%object transfer function

Kp=2;Ti=2;Td=0;%由对象模型求出理想PID

%PID tranfer function

disp('PID tranfer function')

G_PID=tf(Kp*[Ti*Td,Ti,1]/Ti,[1,0])

%Close tranfer function

G=feedback(G_PID*G_obj,1);

figure;

grid on;

hold on

step(G,'g')

xlabel('t');

ylabel('y');

%axis([0,12,0,1.3]);

grid on;

%error

hold off;

[y,t]=step(G);

error=1-y;

figure

plot(t,error)

xlabel('t');

ylabel('error');

grid on

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。