写在m文件里:function f=y(J,Kp,Ki)G=tf([1,1],[J,2,5],'Variable','s')Gc=([Kp,Ki],[1,0],'Variable','s')f=feedback(G,Gc)
1 回答

临摹微笑
TA贡献1982条经验 获得超2个赞
%[1 1 1]就是给a(1),a(2),a(3) 参数赋予初值
%程序运行不了是因为你定义的内联函数inline有错,注意t为数组运算符得用点
t=[1790:10:2000];
p=[3.9 5.3 7.2 9.6 12.9 17.1 23.2 31.4 38.6 50.2 62.9 76.0 92.0 106.5 123.2 131.7 150.7 179.3 204.0 226.5 251.4 281.4];
ft=inline('a(1).*a(2)./(a(1)+exp(-a(3).*t).*a(2)-exp(-a(3).*t).*a(1))','a','t');
a=nlinfit(t,p,ft,[1 1 1])
%a = 1.0000 94.7727 1.0000
%但是给出警告,拟合结果不好,得参考帮助设置一下optimset
- 1 回答
- 0 关注
- 117 浏览
添加回答
举报
0/150
提交
取消