predprey.m
来自「ode routines in matlab」· M 代码 · 共 31 行
M
31 行
function [out] = PredPrey(x, y, flag)%% Evaluate the right hand side function for the% Predator Prey model%% y_1'(x) = alpha*y_1(x) - beta*y_1(x)*y_2(x)% y_2'(x) = gamma*y_2(x) + delta*y_1(x)*y_2(x)%%%alpha = 0.25;beta = 0.01;gamma = -1.00;delta = 0.01;switch( flag ) case '' % return right hand side out = [ alpha*y(1)-beta*y(1)*y(2); gamma*y(2)+delta*y(1)*y(2) ]; case 'jacobian' % return Jacobian of right hand side out = [ alpha-beta*y(2) -beta*y(1); delta*y(2) gamma+delta*y(1)]; otherwise error(['Unknown request.'])end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?