matlab画平面向量场微分方程y'=y(1-y):y(0)=0.2给定区域为0

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 17:16:33
matlab画平面向量场微分方程y''=y(1-y):y(0)=0.2给定区域为0matlab画平面向量场微分方程y''=y(1-y):y(0)=0.2给定区域为0matlab画平面向量场微分方程y''=y

matlab画平面向量场微分方程y'=y(1-y):y(0)=0.2给定区域为0
matlab画平面向量场
微分方程y'=y(1-y):
y(0)=0.2
给定区域为0

matlab画平面向量场微分方程y'=y(1-y):y(0)=0.2给定区域为0
x1=linspace(0,6,50);
y1=linspace(0,2,30);
[xx,yy]=meshgrid(x1,y1);
dy=yy.*(1-yy);
dx=ones(size(xx));
dx=dx./(sqrt(dx.^2+dy.^2)+eps);
dy=dy./(sqrt(dx.^2+dy.^2)+eps);
quiver(xx,yy,dx,dy)
axis([0,6,0,2])
[x1,yy1]=ode23('fequ',x1,0.2);
[x1,yy2]=ode23('fequ',x1,1.8);
hold on
plot(x1,yy1,x1,yy2);
streamline(xx,yy,dx,dy,0,0.5);
streamline(xx,yy,dx,dy,0,1.5);
streamline(xx,yy,dx,dy,1,0.5);
streamline(xx,yy,dx,dy,1,1.5);
function s=fequ(tt,xx)
s=xx.*(1-xx);