作业帮 > 综合 > 作业

matlab大神,求解微分方程组代码

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/25 01:16:12
matlab大神,求解微分方程组代码

求代码

lumda=1;
mu=0.3;
fun=@(t,is)[lumda*is(2)*is(1)-mu*is(1);-lumda*is(2)*is(1)];
[T,Y]=ode45(fun,[0 100],[0.02 0.98]); %时间区间个可以选择
subplot(211),plot(T,Y);
xlabel('t');
legend('i','s');
subplot(212),plot(Y(:,2),Y(:,1));
xlabel('s');
ylabel('i');