PID命令的数字答案 [英] Numeric answer for PID command

查看:97
本文介绍了PID命令的数字答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了Simulink PD模型并使用了值:

I used a Simulink PD model and used values:

P=100; D=10; N=100

我输入的是

 [0;0;0]-[0.05*(10-t);0.04*(10-t);0.03*(10-t)] where t=1:10

我从仿真中获得了数值.

I get numeric values from the simulation.

我正在尝试在脚本文件中实现相同的功能,但是我得到了传递函数格式的答案.我希望答案采用Simulink那样的数字形式,这是我的MATLab代码:

I am trying to implement the same in script file but I get answer in transfer function format. I want the answer to be in numeric form like that from Simulink, Here is my MATLab code:

for t = 1:10
T_d = [0;0;0];
T_o = [0.05*(10-t);0.04*(10-t);0.03*(10-t)];
T_e = T_d-T_o;
C = pid(100,0,10,100)

T_u=T_e*C

end

在这方面请帮助我.

推荐答案

您需要使用

You need to use the lsim function:

t = 1:0.01:10;
T_o = [0.05*(10-t);0.04*(10-t);0.03*(10-t)];
T_d = zeros(size(T_o));
T_e = T_d - T_o;
C = pid(100,0,10,100);
res = zeros(size(T_e));
for k=1:size(T_e,1)
   res(k,:) = lsim(C,T_e(k,:),t);
end
plot(t,res)

这篇关于PID命令的数字答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆