1、练习 17 常微分方程(二)知识背景常微分方程常用在对模型的分析运用中,特别是在环境、生态、人口等模型中可以比较方便地通过研究模型来得到一些信息并可以采取一些措施。下面我们介绍一个比较有名的生态学的人口动力学模型,可以认为是单一的捕食者和被捕食考模型。通过这个模型的研究我们可以推广到对多数模型的研究,读者可以通过这个模型来了解 MATLAB 对数学模型的处理。主要内容【本练习考查知识点】本练习主要通过已有的函数来研究数学模型,并通过模型的抽象化以及对模型的研究处理让读者掌握对一般数学模型的理解,并让读者能够初步拳据常微分方程建模的基本方法。练习过程(1)x1 表示被捕食者,例如鸡等;x2 表示
2、捕食者,例如黄鼠狼等。而在自然界中,各种种群是相互依存,互相制约的关系。种群 1 靠自然资源来生存,种群 2 靠捕食种群 1 来生存,它们这种生存方式在生态学中称为捕食考一被捕食考模型。(2)对于被捕食者而言,其食物主要是天然资源,即被捕食考主要从周围环境中取得食物,其生存与自然环境的关系比较紧密。周围环境如天气、温度、水和食物生长都会影响到捕食者的生存。而被捕食者的数量除了与自然环境有关以外,还受捕食者的影响。捕食考数量少时,对被捕食者的数量有一定影响。但当捕食者数量激增后,其数量的增加势必要影响到被捕台考的数量。以被捕食者为食物源的捕食者数量增加使被捕食者数量减少,如果捕食考数量持续增加,
3、则被捕食者的数量减少势必会影响到捕食者的数量,此时亦造成捕食者数量的减少,这里它们之间是一个作用与反作用的关系。(3)对于捕食者而言,其主要食物是被捕食者( 如鸡)t 影响其生存的主要是与其生存相关的气候及其他因素。而其食物掘是影响其数量的最大因素,捕食者数量的增加会导致被捕食者数量的减少,而当捕食者数量不足时,被捕食者数量的增加也会使被捕食看台物减少从而反作用与被捕食者的数量。(4)通过分析捕食者和被捕食者之间的关系,则有如下的关系方程组:x1=x1-0.81x1*x2 (1)x2=-x2+0.028*x1*x2 (2)x1(0)=30 (3)x2(0)=20 (4)这个微分方程组只是较简化
4、地描绘出捕食者与被捕食者之间的关系,只是一个简化模型型。我们通过赋予其一定的初值来研究这个模型。编程序如下:biomodel1.m 文件:function biofun=biomodel(t,x)biofun=x(1)-0.01*x(1)*x(2);-x(2)+0.02*x(1)*x(2);程序如下:ts=0:0.1:20;x0=30,20;t,x=ode45(biomodel,ts,x0);t,xplot(t,x),grid,gtext(x(1),gtext(x(2)plot(x(:,1),x(:,2),grid,xlabel(x1),ylabel(x2)运行结果如下:t x1 x20 30
5、.0000 20.00000.1000 32.5109 19.26340.2000 35.2557 18.65170.3000 38.2534 18.16330.4000 41.5237 17.79870.5000 45.0870 17.56100.6000 48.9645 17.45590.7000 53.1712 17.50070.8000 57.7312 17.70430.9000 62.6726 18.07321.0000 68.0140 18.62921.1000 73.7648 19.40871.2000 79.9247 20.46331.3000 86.4842 21.85961
6、.4000 93.4243 23.67881.5000 100.7153 26.01731.6000 108.2830 28.99531.7000 116.0366 32.81761.8000 123.8174 37.76001.9000 131.3752 44.15982.0000 138.3683 52.41642.1000 144.3642 62.99072.2000 148.8388 76.40592.3000 151.1768 93.24652.4000 150.6838 114.11932.5000 146.7730 139.11742.6000 139.1754 167.6539
7、2.7000 128.1014 198.29722.8000 114.3474 228.72092.9000 99.1265 256.23743.0000 83.9454 278.01683.1000 69.7146 293.08673.2000 56.9335 301.48993.3000 45.9863 303.44433.4000 37.1419 299.34403.5000 30.4828 289.92413.6000 25.3802 277.33453.7000 21.3963 262.93773.8000 18.2747 247.58573.9000 15.8547 231.845
8、54.0000 14.0072 216.12924.1000 12.5704 200.81794.2000 11.4484 186.11544.3000 10.5706 172.15554.4000 9.8912 159.00314.5000 9.3817 146.67054.6000 9.0059 135.17394.7000 8.7422 124.49714.8000 8.5740 114.61394.9000 8.4888 105.49025.0000 8.4782 97.08425.1000 8.5356 89.35185.2000 8.6573 82.24945.3000 8.841
9、5 75.73405.4000 9.0871 69.76425.5000 9.3935 64.30065.6000 9.7612 59.30535.7000 10.1911 54.74235.8000 10.6852 50.57755.9000 11.2472 46.77966.0000 11.8817 43.31916.1000 12.5940 40.16846.2000 13.3899 37.30246.3000 14.2761 34.69786.4000 15.2596 32.33386.5000 16.3483 30.19166.6000 17.5505 28.25486.7000 1
10、8.8754 26.50906.8000 20.3326 24.94206.9000 21.9332 23.54277.0000 23.6912 22.29817.1000 25.6204 21.19757.2000 27.7354 20.23237.3000 30.0522 19.39577.4000 32.5874 18.68327.5000 35.3590 18.09217.6000 38.3859 17.62167.7000 41.6882 17.27327.8000 45.2868 17.05017.9000 49.2040 16.95758.0000 53.4627 17.0031
11、8.1000 58.0771 17.20928.2000 63.0726 17.58748.3000 68.4750 18.15198.4000 74.2978 18.93478.5000 80.5429 19.98608.6000 87.2002 21.37398.7000 94.2474 23.18438.8000 101.6508 25.52128.9000 109.3480 28.50629.0000 117.2327 32.33109.1000 125.1500 37.28229.2000 132.8482 43.71239.3000 139.9776 52.04009.4000 1
12、46.0903 62.74939.5000 150.6406 76.39049.6000 152.9848 93.57919.7000 152.3984 114.94299.8000 148.2745 140.57709.9000 140.3422 169.869110.0000 128.8377 201.303610.1000 114.6192 232.420410.2000 98.9704 260.406010.3000 83.4544 282.353910.4000 68.9901 297.340310.5000 56.0953 305.414210.6000 45.1505 306.8
13、36010.7000 36.3984 302.078310.8000 29.8353 292.080110.9000 24.7920 279.054311.0000 20.8622 264.280611.1000 17.7924 248.605011.2000 15.4297 232.574511.3000 13.6244 216.634111.4000 12.2219 201.139211.5000 11.1268 186.289911.6000 10.2703 172.213411.7000 9.6100 158.964311.8000 9.1162 146.553811.9000 8.7
14、525 134.996012.0000 8.4980 124.271212.1000 8.3365 114.351112.2000 8.2559 105.199212.3000 8.2480 96.771512.4000 8.3064 89.023012.5000 8.4278 81.908912.6000 8.6104 75.385512.7000 8.8528 69.411012.8000 9.1547 63.945012.9000 9.5163 58.949213.0000 9.9386 54.386713.1000 10.4238 50.223213.2000 10.9756 46.4
15、27113.3000 11.5988 42.968513.4000 12.2985 39.819813.5000 13.0807 36.955613.6000 13.9517 34.352813.7000 14.9185 31.990313.8000 15.9889 29.849613.9000 17.1709 27.914014.0000 18.4733 26.169214.1000 19.9057 24.603214.2000 21.4802 23.202914.3000 23.2102 21.955414.4000 25.1091 20.850514.5000 27.1914 19.87
16、9614.6000 29.4727 19.036114.7000 31.9700 18.315114.8000 34.7013 17.713614.9000 37.6858 17.230415.0000 40.9438 16.866015.1000 44.4969 16.622915.2000 48.3679 16.505315.3000 52.5770 16.523915.4000 57.1435 16.694915.5000 62.0969 17.023815.6000 67.4592 17.529515.7000 73.2434 18.245515.8000 79.4537 19.219
17、515.9000 86.0857 20.514116.0000 93.1262 22.205916.1000 100.5487 24.389116.2000 108.2746 27.206416.3000 116.2414 30.824516.4000 124.3120 35.483116.5000 132.2479 41.509716.6000 139.7103 49.319416.7000 146.2590 59.414716.8000 151.3533 72.385816.9000 154.3515 88.910417.0000 154.5240 109.617317.1000 151.
18、1838 134.747217.2000 143.9508 163.893217.3000 132.9289 195.717717.4000 118.8590 227.886417.5000 103.0537 257.352517.6000 86.9685 281.454017.7000 71.7286 298.731317.8000 58.2099 308.379517.9000 47.0407 310.239118.0000 38.2113 305.566318.1000 31.2409 296.301618.2000 25.7959 283.834318.3000 21.5948 269
19、.282118.4000 18.3872 253.557818.5000 15.9140 237.403718.6000 13.9719 221.331518.7000 12.4232 205.690818.8000 11.1957 190.668718.9000 10.2766 176.302419.0000 9.5869 162.722519.1000 9.0626 150.004619.2000 8.6729 138.153619.3000 8.3944 127.156319.4000 8.2113 116.981519.5000 8.1110 107.590119.6000 8.084
20、8 98.939419.7000 8.1265 90.985019.8000 8.2313 83.682419.9000 8.3959 76.987520.0000 8.6184 70.8561绘制的图形如图 17-1 和图 17-2 所示。图 17-1 捕食者模型周期图图 17-2 捕食者模型相同通过图则可以看出,x1 和 x2 都是周期函数,而相图(x1 砌则趋于封闭曲线,从数值解上我们可以大致作出判断周期为 73,x1 和 x2 的最大、最小值都可以通过所列数据得出,并根据所列致据和周期求一个周期内的平均值。由于拟合插值前已述及,这里不再给出求解过程。而模型方程的系数部有一定的实际意义,
21、其具体内容请参看数学模型(姜启源著,高教出版社)。此时,我们可以给出捕食者模型的相图。(5)以上例题的模型被简化,如果我们加入其他因索的影响,食动物的生老病死等,我们可以得到一个以下的模型:x1=x1-0.1*x1*x2+0.01*t (1)x2=-x2+0.02*x1*x2+0.04*t (2)x1(0)=30 (3)x2(0)=20 (4)依上例,编 biomodel1.m 文件如下:function biofun=biomodel(t,x)biofun=x(1)-0.01*x(1)*x(2)+0.01*t;-x(2)+0.02*x(1)*x(2)+0.04*t;在命令区中输入运行程序:t
22、s=0:0.1:20;x0=30,20;t,x=ode45(biomodel1,ts,x0);运行结果如下:t x1 x20 30.0000 20.00000.1000 32.5110 19.26360.2000 35.2559 18.65250.3000 38.2538 18.16510.4000 41.5244 17.80180.5000 45.0881 17.56590.6000 48.9660 17.46310.7000 53.1729 17.51060.8000 57.7331 17.71740.9000 62.6746 18.09031.0000 68.0160 18.65071.
23、1000 73.7663 19.43541.2000 79.9253 20.49611.3000 86.4831 21.89961.4000 93.4203 23.72771.5000 100.7071 26.07691.6000 108.2696 29.06591.7000 116.0156 32.90161.8000 123.7847 37.86201.9000 131.3260 44.28562.0000 138.2975 52.57132.1000 144.2669 63.17842.2000 148.7107 76.62672.3000 151.0150 93.49622.4000
24、150.4867 114.39082.5000 146.5429 139.39922.6000 138.9209 167.92302.7000 127.8376 198.52352.8000 114.0924 228.87502.9000 98.8968 256.29903.0000 83.7564 277.97543.1000 69.5888 292.90583.2000 56.8559 301.21843.3000 45.9183 303.17923.4000 37.0358 299.19173.5000 30.3385 289.86473.6000 25.2668 277.21973.7
25、000 21.3139 262.78233.8000 18.2147 247.41113.9000 15.7995 231.68634.0000 13.9594 215.98004.1000 12.5327 200.67944.2000 11.4210 185.99004.3000 10.5532 172.04374.4000 9.8813 158.90954.5000 9.3766 146.60044.6000 9.0059 135.12644.7000 8.7469 124.47224.8000 8.5835 114.61074.9000 8.5032 105.50805.0000 8.4
26、974 97.12295.1000 8.5597 89.41075.2000 8.6862 82.32805.3000 8.8753 75.83145.4000 9.1259 69.87965.5000 9.4380 64.43315.6000 9.8118 59.45415.7000 10.2486 54.90705.8000 10.7501 50.75775.9000 11.3198 46.97496.0000 11.9623 43.52936.1000 12.6829 40.39356.2000 13.4875 37.54256.3000 14.3825 34.95316.4000 15
27、.3752 32.60466.5000 16.4734 30.47806.6000 17.6857 28.55686.7000 19.0213 26.82656.8000 20.4900 25.27466.9000 22.1026 23.89077.0000 23.8725 22.66317.1000 25.8138 21.58067.2000 27.9412 20.63477.3000 30.2704 19.81867.4000 32.8180 19.12807.5000 35.6015 18.56047.6000 38.6391 18.11597.7000 41.9503 17.79647
28、.8000 45.5551 17.60617.9000 49.4745 17.55158.0000 53.7307 17.64108.1000 58.3408 17.89238.2000 63.3186 18.33138.3000 68.6925 18.96848.4000 74.4775 19.83288.5000 80.6735 20.97498.6000 87.2653 22.46658.7000 94.2228 24.40048.8000 101.5005 26.89078.9000 109.0386 30.06709.0000 116.7442 34.05809.1000 124.4
29、216 39.20879.2000 131.7907 45.93089.3000 138.4941 54.65289.4000 144.0971 65.82009.5000 148.0875 79.89439.6000 149.8762 97.35449.7000 148.7965 118.69579.8000 144.2545 144.10309.9000 136.1076 172.725410.0000 124.6733 202.996410.1000 110.8044 232.573510.2000 95.7603 258.782510.3000 80.8213 279.409810.4
30、000 67.0586 293.054810.5000 55.0868 299.508610.6000 45.0963 299.535810.7000 37.0540 294.182110.8000 30.7096 284.740210.9000 25.7032 272.570411.0000 21.7994 258.624911.1000 18.7320 243.735811.2000 16.3127 228.504911.3000 14.4353 213.297911.4000 12.9971 198.403311.5000 11.8766 184.080011.6000 11.0051 170.453911.7000 10.3308 157.602611.8000 9.8196 145.555711.9000 9.4470 134.310312.0000 9.1884 123.859212.1000 9.0282 114.175912.2000 8.9543 105.228812.3000 8.9575 96.981312.4000 9.0316 89.392112.5000 9.1719 82.4182