✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
动力学和控制理论中的一个经典问题是可倒摆法的平衡,这个问题已经被广泛用作测试控制算法的基准,例如线性二次调节器(lQR)。LQR 的性能在很大程度上取决于状态和控制加权矩阵(Q & R)的设计选择。然而,这些矩阵通常是由设计人员通过试错迭代过程选择的,这可能不能保证鲁棒性,并可能增加计算时间。针对这一问题,提出了一种基于加权人工鱼群算法(wAFSA)的 LQR 加权矩阵优化方法。所设计的控制器,然后用于获得一个动态非线性四重可倒摆法(QIP)的最优控制器。本文首先在标准人工鱼群算法(AFSA)中引入一种称为惯性权重的方法来自适应地选择其参数(视觉和步长) ,然后采用改进算法随机确定 LQR 权矩阵的优化值。采用标准 AFSA 算法和标准人工蜂群(ABC)算法确定加权矩阵的优化值。然后这被用来稳定 QIP 系统。仿真结果表明,与传统的试错法相比,该方法能够有效地确定 LQR 的加权矩阵,并使求解时间最短。
⛄ 部分代码
function dynamicResponses(t,X2wAF,X2AF,X2abc,X22,X3wAF,X3AF,X3abc,X33,X4wAF,X4AF,X4abc,X44,X5wAF,X5AF,X5abc,X55)
figure('Name','First PENDULUM')
plot(t,X2wAF,'b')
hold on
plot(t,X2AF,'g')
hold on
plot(t,X2abc,'c')
hold on
plot(t,X22,'r')
xlabel('Time(s)')
ylabel('First Pendulum Angle (rad)')
title('Response of the First PENDULUM')
legend('Angular Velocity of the First Pendulum (AFSA)','Angular Velocity of the First Pendulum(wAFSA)','Angular Velocity of the First Pendulum(ABC)'...
,'Angular Velocity of the First Pendulum(T and E)')
grid on
wAF_1=stepinfo(X2wAF,t)
AF_1=stepinfo(X2AF,t)
abc_1=stepinfo(X2abc,t)
TandE_1=stepinfo(X22,t)
%Plot for the Second Pendulum
figure('Name','Second PENDULUM')
plot(t,X3wAF,'b')
hold on
plot(t,X3AF,'g')
hold on
plot(t,X3abc,'c')
hold on
plot(t,X33,'r')
title('Response of the Second PENDULUM')
xlabel('Time(s)')
ylabel('Second Pendulum Angle (rad)')
legend('Angular Velocity of the Second Pendulum (AFSA)','Angular Velocity of the Second Pendulum (wAFSA)',...
'Angular Velocity of the Second Pendulum (ABC)','Angular Velocity of the Second Pendulum(Trial & Error)')
wAF_2=stepinfo(X3wAF,t)
AF_2=stepinfo(X3AF,t)
abc_2=stepinfo(X3abc,t)
TandE_2=stepinfo(X33,t)
grid on
%Plot for the Third Pendulum
figure('Name','Third PENDULUM')
plot(t,X4wAF,'b')
hold on
plot(t,X4AF,'g')
hold on
plot(t,X4abc,'c')
hold on
plot(t,X44,'r')
title('Response of the Third PENDULUM')
xlabel('Time(s)')
ylabel('Third Pendulum Angle (rad)')
legend('Angular Velocity of the Third Pendulum (AFSA)','Angular Velocity of the Third Pendulum (wAFSA)',...
'Angular Velocity of the Third Pendulum (ABC)','Angular Velocity of the Third Pendulum (Trial & Error)')
grid on
wAF_3=stepinfo(X4wAF,t)
AF_3=stepinfo(X4AF,t)
abc_3=stepinfo(X4abc,t)
TandE_3=stepinfo(X44,t)
%Plot for the Fourth Pendulum
figure('Name','Fourth PENDULUM')
plot(t,X5wAF,'b')
hold on
plot(t,X5AF,'g')
hold on
plot(t,X5abc,'c')
hold on
plot(t,X55,'r')
xlabel('Time(s)')
ylabel('Fourth Pendulum Angle (rad)')
legend('Fourth Pendulum Angular Velocity (AFSA)','Fourth Pendulum Angular Velocity (wAFSA)',...
'Fourth Pendulum Angular Velocity (ABC)','Fourth Pendulum Angular Velocity (Trial and Error)')
title('Response of the Fourth PENDULUM')
grid on
wAF_4=stepinfo(X5wAF,t)
AF_4=stepinfo(X5AF,t)
abc_4=stepinfo(X5abc,t)
TandE_4=stepinfo(X55,t)
⛄ 运行结果
⛄ 参考文献
⛄ 完整代码
❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料