matlab中的微分方程的数值积分

 时间:2024-10-12 04:55:56

1、函数y1和y2分别测量食饵和捕食者的种群大小。二次交叉项说明了物种之间的相互作用。注意,当没有捕食者时,被捕食者数量增加,但当没有被捕食者时,捕食者数量减少。为了模拟一个系统,创建一个函数,该函数返回给定状态和时间值的状态导数列向量。对于这个示例,我们创建了一个名为LOTKA.M的文件。type lotka

2、模拟0区间上的LOTKA中定义的微分方程% Define initial conditions.t0 = 0;tfinal = 15;y0 = [20 20]';% Simulate the differential equation.tfinal = tfinal*(1+eps);[t,y] = ode23(@lotka,[t0 tfinal],y0);

3、Plot the result of the simulation two different ways.subplot(1,2,1)plot(t,y)title('Time history')subplot(1,2,2)plot(y(:,1),y(:,2))title('Phase plane plot')

matlab中的微分方程的数值积分

4、Now simulate LOTKA using ODE45, instead of ODE23. ODE45 takes longer at each step荑樊综鲶, but also takes larger steps. Nevertheless, the output of ODE45 is smooth because by default the solver uses a continuous extension formula to produce output at 4 equally spaced time points in the span of each step taken. The plot compares this result against the previous.[T,Y] = ode45(@lotka,[t0 tfinal],y0);subplot(1,1,1)title('Phase plane plot')plot(y(:,1),y(:,2),'-',Y(:,1),Y(:,2),'-');legend('ode23','ode45')

matlab中的微分方程的数值积分
  • MATLAB R2015b怎么设置百分率为100%
  • MATLAB中怎么把矩阵写入txt文档中去啊
  • Matlab中怎样生成矩阵
  • MATLAB中方阵系统的运算
  • matlab关于阶梯图的介绍
  • 热门搜索
    大排的做法 对联上下联怎么分左右 黄焖鸡的做法视频 泵怎么读 老醋花生米的做法 鲷鱼的做法 打嗝不止怎么办 教你止嗝小方法 鸡翅做法 葱油面的做法 猪肺的做法