ex15bch1.m

来自「these codes are for solving OED with mat」· M 代码 · 共 25 行

M
25
字号
function ex15bch1a = 2;c = 1;options = odeset('RelTol',1e-6);[t,ysol] = ode45(@odes,[0 10],[1; 3],options,a,c);x = ysol(:,1);y = ysol(:,2);G = exp(c*x + a*y) ./ (x.^c .* y.^a);figureplot(x,y)xlabel('x(t)')ylabel('y(t)')axis([0 4.5 0 3.5])title('Solution of Volterra''s predator-prey model.')figureplot(t,G)title('Conserved Quantity G(t,x(t),y(t)).')%===============================================function dydt = odes(t,ysol,a,c)x = ysol(1);y = ysol(2);dxdt =  a * (x - x*y);dydt = -c * (y - x*y);dydt = [dxdt; dydt];

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?