clear;clc
c=2/3; %设置c的值
x(1)=0.1; %设置x初值为0.1
y(1)=0.3; %设置y初值为0.3
h=0.05; %设置步长为0.05
%for循环:根据Euler法,求解微分方程组
for i=1:1000
x(i+1)=x(i)+h*(x(i)*(c-x(i)/y(i)));
y(i+1)=y(i)+h*(y(i)*(1-y(i))-x(i)*y(i));
end
t=0:h:1000*h; %计算时间
plot(t,x) %绘制x曲线
hold on
plot(t,y,'r') %绘制y曲线
xlabel('time') %设置x轴的标签
ylabel('value') %设置y轴的标签
legend({'x','y'}) %设置图例
title('time evolution plot') %设置图形的标题
figure
plot(x,y) %绘制phase图
title('phase plane plot') %设置标题
xlabel('x') %设置x轴的标签
ylabel('y') %设置y轴的标签
msgbox('MATLAB编程答疑,请加QQ: 1530497909','MATLAB答疑','help')
web http://url.cn/TKcdXk -browser


阿里matlab建模师
- 粉丝: 5360
- 资源: 2942
最新资源
- [AB PLC例程源码][MMS_052709]DataSite to CLX Master Accelerator Toolkit.zip
- [AB PLC例程源码][MMS_052443]Simple Taught Color Sensing Building Block.zip
- [AB PLC例程源码][MMS_052442]eProcedure for Mobile devices.zip
- [AB PLC例程源码][MMS_052836]Analog in - discrete out.zip
- [AB PLC例程源码][MMS_052710]DataSite to ME Master Accelerator Toolkit.zip
- [AB PLC例程源码][MMS_052711]DataSite to SE MasterAccelerator Toolkit.zip
- [AB PLC例程源码][MMS_052929]PowerFlex 70.zip
- [AB PLC例程源码][MMS_052875]ME Faceplate_AOI for Kinetix Servo Drives Rev 4 (V17_V5).zip
- [AB PLC例程源码][MMS_052903]Hardy 1769 weigh scale AOP - Add On Profile.zip
- [AB PLC例程源码][MMS_052942]PF755 Demo_Scale Block.zip
- [AB PLC例程源码][MMS_052944]PF755 Demo_RTC Example.zip
- [AB PLC例程源码][MMS_052943]PF755 Demo_Diverter Example.zip
- [AB PLC例程源码][MMS_052963]Step Sequencer AOI.zip
- [AB PLC例程源码][MMS_052946]PF755 Demo_Wet Well Example.zip
- [AB PLC例程源码][MMS_052945]PF755 Demo_Selector Switch.zip
- [AB PLC例程源码][MMS_052964]Tank Volume with handlers and end caps.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


