popdemo.m

来自「数字通信第四版原书的例程」· M 代码 · 共 45 行

M
45
字号
echo off
% POPDEMO
%    --------------   Population Demo   ---------------
%   This system models a population in which the number of 
%   members follows the law dm/dt = a * m - b * m * m.
%   A is taken to represent a reproductive rate and b 
%   represents competition.
%
%   20 simulations will be run using different starting 
%   populations.

%	Copyright (c) 1990-94 by The MathWorks, Inc.

clc
clg
hold off; 
help popdemo
echo on
pause % Strike any key to continue.
axis([0,300,0,100]);
plot(0,0,300,100);
grid;
xlabel('Time');
ylabel('Population Size');
hold on;
echo on;
%
%    This loop runs 20 simulations and plots the results.

for ind = 20:-1:1
    initial_pop = ind * 5 + 1;
    [t,x] = rk23('pops',300); 
    % use Runga-Kutta to simulate pops until t = 300.
    plot(t,x);
end
%   Different numbers in a and b will result in different 
%   final populations.  You can change these values 
%   and select this demo from the menu again.
%
pause   
%   Select this window and strike any key to end this demo.
echo off;
hold off;
clc;

⌨️ 快捷键说明

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