clear all;
close all;
%% create grid for direction plot
[Q1,Q2]=meshgrid(-1.5:.3:1.5,-0.7:.14:0.7);
%% create matrices with elements of vector Qd
Qd1=zeros(size(Q1));
Qd2=zeros(size(Q2));
for i=1:11;
for j=1:11;
Qdot=duffing(0,[Q1(i,j);Q2(i,j)]);
Qd1(i,j)=Qdot(1);
Qd2(i,j)=Qdot(2);
end
end
%% plot direction plot
figure(1);
quiver(Q1,Q2,Qd1,Qd2);
xlabel('q_1');
ylabel('q_2')
title('Direction field of Duffing equation');
%% create time vector and numerical solution with ode45
[t, Q]=ode45('duffing',[0 30],[1.5;0]);
%% plot trajectory in time
figure(2)
plot(t,Q(:,1))
xlabel('t');
ylabel('q_1');
figure(3)
plot(t,Q(:,2))
xlabel('t');
ylabel('q_2');
%% plot trajectory in phase space
figure(4);
quiver(Q1,Q2,Qd1,Qd2);
xlabel('q_1=x');
ylabel('q_2=dotx')
title('Solution curve in phase plane');
hold on;
plot(Q(:,1),Q(:,2),'k');
imc.rar_IMC_control_predictive_predictive control
版权申诉
59 浏览量
2022-09-21
20:10:57
上传
评论
收藏 26KB RAR 举报
周楷雯
- 粉丝: 80
- 资源: 1万+
最新资源
- Delphi教程&案例&软件项目管理案例教程(第四版)课后习题答案.pdf
- Nasa高分卫星火点监测数据接入源码
- 基于区块链的图片版权保护系统的设计与实现+详细文档+全部资料(高分毕业设计).zip
- N0100P-VB一款SOT23封装P-Channel场效应MOS管
- 数据分析2024版Tecplot360中文教程最全解析.ppt
- 基于区块链的图片版权保护系统的设计与实现+详细文档+全部资料(高分毕业设计).zip
- 上海大众帕萨特1.8GLI 2005款线路图
- MVSF2N02ELT1G-VB一款SOT23封装N-Channel场效应MOS管
- 基于区块链的图片版权保护系统的设计与实现+详细文档+全部资料(高分毕业设计).zip
- MVGSF1N03LT1G-VB一款SOT23封装N-Channel场效应MOS管
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈