1、第二章第二章 连续系统数值积分法连续系统数值积分法:就是利用数值积分方:就是利用数值积分方法对常微分方程建立离散化形式的数学模型(差法对常微分方程建立离散化形式的数学模型(差分方程)并求出数值解。分方程)并求出数值解。最常用的数值解法有:最常用的数值解法有:欧拉法、梯形法、欧拉法、梯形法、Adams、RungeKutta法。法。00)()(,()(xtxtuxtftx,210,nttttt dttuxtftxtxnttn 10)(,()()(01dttuxtftxntt 0)(,()(0 1)(,(nnttdttuxtfdttuxtftxdttuxtftxtxnnnttnttn 110)(,(
2、)()(,()()(01 1)(,(1nnttnnnndttuxtfQQxxnttt21dttuxtfnntt1)(,(nx)(ntxnQ,21nxxxnnntth1dttuxtftxtxnnttnn 1)(,()()(1(精精确确值值)),(,),(),(21ntxtxtxdttuxtfnntt1)(,(,21,nttt,21,nxxx 21!2)()()()()(htxhtxtxhtxtxnnnnn00)()(,()(xtxtuxtftx),(1nnnnnuxthfxx htxtxtxnnn)()()(1 huxtftxnnnn),()(00)()(,()(xtxtuxtftx1,nntt
3、1)(,()()(1nnttnndttuxtftxtx)(,(tuxtf1,nntt)(,(tuxtfnnnnnnhfxx1huxtftxtxnnnnn),()()(11)(,()()(1nnttnndttuxtftxtx)(,(tuxtf1,nntt)(,(111tuxtfnnn11nnnhfxxhuxtftxtxnnnnn),()()(1111nt)(,(tuxtfttdtdxnnnnnnnhfxx1ntnt)(,(nnnnnttuxtfxx1nt)(1ntx),()()(1nnnnnuxthftxtxnnxt,1,nntt)(,(1111tuxtfttdtdxnnnn11nnnhfxx1
4、nt1ntnnxt,)(,(111nnnnnttuxtfxx1nt)(1ntx),()()(1111nnnnnuxthftxtx1)0(,0)()(2ytyty10 t)(),(),()(22tyytftyty 即即),(111nnnnythfyy)(1.0121nnyy)1.01(11 nnyy1,000yt9.01.01)1.01(,1.00011yyyt819.091.09.0)1.01(,2.01122yyyt4682.0)1.01(,1991010yyyt),(1nnnnythfyy211.0nnyy525101nnyy1)(,(nnttdttuxtf111,21)(,(1nnnnn
5、nttuxtfuxtfhdttuxtfnn112nnnnffhxx梯形近似及其误差)(,nntxt)(,11nntxt),(),()(2111121211nnnnnnnnuxtfkuxtfkkkhxxr,k,kk21riiirrwkkkkk12211 1111122222nnnnnnnnnhhhhxxffxffxf12nx)(1ntx),(1nnnnpythfxx1npx1nf1npf),(),(2111npnnnnncytfytfhxx1)0(,0)()(2ytyty10 t)(),(),()(22tyytftyty 即即),(),(2111nnnnnnytfytfhyy)(05.02121
6、nnnyyy1010020121nnnyyy1)0(,0)()(2ytyty10 t)(),(),()(22tyytftyty 即即2112kkhyynn),(1nnnnnpuythfyy),(1111nnnuytfk),(2nnpnuytfk)(,tuxtf)(,)2(tXxxtftxtftXxtf,00)(),()(xtxxtftxxtf,),()(xtftx),(,xtfxxtftxtfmmxtx)(pmpmmmmmhtxphtxhtxtxhtxtx)(!1)(!21)()()()()(21pmmpmmmmmhxtfphxtfhxtftx),(!1),(!21),()()1(2)(,),
7、(),()(mpmmtxtxtx)1()1(),(!1),(!21),(),(,(pmmpmmmmhxtfphxtfxtfhtxthhtxttxxtxmmm),(,()()(11hhtxtxxmm),(,(1)(11mmtxx与11)(mmxtx)2()2()1()1()()!2(1)()!1(1pmppmphtxphtxp 21!2)()()()()(htxhtxtxhtxtxnnnnnnnnhfxx 1htxtxtxnnn)()()(1 huxtftxnnnn),()(11)(nnxtx 32!3)(!2)(htxhtxnn 321!3)(!2)()()()()(htxhtxhtxtxht
8、xtxnnnnnn!2)()()()(21htxhtxtxtxnnnn htxtxtxhtxnnnn)()()(2)(11)(nnxtx112nnnnffhxx hhtxtxtxtxhtxnnnnn)()()()(2)(1 )()(2)(1 nnntxtxhtxxtf,hhtxtxxmm),(,(1)1()1(),(!1),(!21),(),(,(pmmpmmmmhxtfphxtfxtfhtxtmmxt,),(,(htxtxtf,),(,(htxthtt,duxftxhtxhtt)(,()()(htt,htttttm 21 mitxtfkiii,321)(,(),ft x th1,(),mii
9、ift x thC K mitxtfkiii,1)(,,)(itx )(,),(11111txtftkt )(,)()()(111212txtftttxtx 1121)()(ktttx 222,txtfk 11212)()(,ktttxtf 333,txtfk 22323)()(,ktttxtf 22311213)()()(,kttktttxtf )(,)()()(222323txtftttxtx 2kmmmExhtxx )(1)(,(mmtxt),(amEmxaht amx)(,(mmtxtammmExhtxx )(110 a),(1 mEmxht)(,(htxhtmm ),(1 mEmxh
10、t12111 mEmEmxbxbxtX(t)tmtm+1x xE Em+1m+1x(tx(tm+1m+1)tm+ahx xE Em+am+aamx 1 mExx(tx(tm m)mmmExhtxx )(1),(amEmxaht amx)(,(mmtxtammmExhtxx )(112111 mEmEmxbxbx)(,(1mmtxtfk)(,(12ahktxahtfkmm )()()(2211211kbkbhtxbbxmm 12111 mEmEmxbxbx ammmmxhtxbxhtxb )()(21ammxkxk 21,22111)()(hktxbhktxbxmmm )()()(221121k
11、bkbhtxbbm )(,(1mmtxtfk)(,(12ahktxahtfkmm )()()(2211211kbkbhtxbbxmm ),(mmxt 12),(ahkxfahtfxtfkmm 2122122222221ahkxfkahxtfahtf 1),(ahkxfahtfxtfmmRRahkxfahtfxtfkmm 12),()(,)2(txxxtftxtftx ),()(xtftx),(,xtfxxtftxtfRtahxtxmm )()()2()()()(2211211kbkbhtxbbxmm )()()()()()2(2121Rtahxtxbtxbhtxbbmmmm hRbtxahbt
12、xhbbtxbbmmm2)2(222121)()()()()(121 bb212 ab 121 bb212 ab )(3hO hRbhtxxtxmmm23)3(11)(!31)(ab2111 ab212 211 b212 b)(,(1mmtxtfk)(,(12hktxhtfkmm )(2)(211kkhtxxmm 01 b12 b)(,(1mmtxtfk)2)(,2(12khtxhtfkmm 21)(hktxxmm 21 a)(,(1mmtxtfk),(11 ijjijmimikahxhctfk piiimmkbhxx11 pi,3,2,1)(,(1mmtxtfk)2,2(12khxhtfkm
13、m 321146kkkhxxmm )2,2(213hkhkxhtfkmm )(,(1mmtxtfk)3,3(12khxhtfkmm 31134kkhxxmm )32,32(23khxhtfkmm )(,(1mmtxtfk)2,2(12khxhtfkmm 43211226kkkkhxxmm ),(34hkxhtfkmm )2,2(23khxhtfkmm ),()(2111nxxxtftx),()(2122nxxxtftx),()(21nnnxxxtftx),(mmmxtfF mmmhFxx 1 ),(111 mmmxtfF11 mmmhFxx ),(mmmxtfF 112 mmmmFFhxx )
14、,(11mmmmhFxtfF ),(111 mmmxtfF 112 mmmmFFhxx),(mmmxtfF)(,(1111mmntxtfkkk )2,2(12122khxhtfkkkmmn 43211226kkkkhxxmm ),(34144hkxhtfkkkmmn )2,2(23133khxhtfkkkmmn )()()(tBUtAXtX )(1mmtBUAXk 2212htBUkhXAkmm 2223htBUkhXAkmm htBUhkXAkmm 341)0(,0)0(,0)(2)(5.0)(yytytyty 21xyxy ,令 21215.0210 xxxx得:01)0()0()0()0
15、()0(21yyxxX初始条件:0 u;05.0210 ,BA系数阵:)计算所有变量的11k 20015.0210021111AXkkk:)计算所有变量的22k 21112010102212221.02kkxxAkhXAkkk 95.11.02021.0015.0210:)计算所有变量的33k 22122010202313321.02kkxxAkhXAkkk 9612.10975.095.11.021.0015.0210:)计算所有变量的44k 23132010302414421.02kkxxAkhXAkkk 9214.11961.09612.10975.021.0015.0210:)计算第一
16、步的近似值5 432101226kkkkhXX 9214.11961.09612.10975.0295.11.022061.001 1957.00099.1仿真时间结束。的近似值,直到所需及)计算下一步的)转到Xkkkk4321161)0(,0,yxyxdxdy时时yxyxfyxxy ),(,)(即即nnnhfyy 1)(*1.00001yxyy 1.1)10(*1.01 )(*1.01112yxyy 22.1)1.11.0(*1.01.1 Xy)0(y1.1)(*1.0000001 yxyhfyy22.1)1.11.0(*1.01.1112 hfyy362.1)22.12.0(*1.022.
17、1223 hfyy前前向向欧欧拉拉法法习习题题 23 1)0(,0,yxyxdxdy时时yxyxfyxxy ),(,)(即即)(211 nnnnffhyy)()(*5.0111 nnnnnnyxyxhyy1105.11 yhxxhyhynnnn5.01)(*5.0*)5.01(11 1105.11 y2432.12 y4004.13 ynyyy,10nfff,10 00)()(,()(xtxtuxtftx 1)(,()()(1mmttmmdttuxtftxtx)()()(2211 mmmmmmftftft,、,、,0122)(atatatp )(,(tuxtf)(tp)(,(tuxtf 11)
18、(,()(mmmmttttdttuxtfdttp0122)(atatatp 212102221212111mmmmmmmmmfffaaatttttt0122)(atatatp 121122121)()()()()(mmmmmmmmmmmmmmfttttttttftttttttttp21221)()(mmmmmmmftttttttthttm httmm 1httmm22 httttmm 1httttmm22 h)1(h)2(121122121)()()()()(mmmmmmmmmmmmmmfttttttttftttttttttp21221)()(mmmmmmmftttttttt1 mtt2 mt
19、th)1(h)2(221222)1()2(2)2()1()(mmmfhhhfhhhfhhhp 21)1(21)2()2)(1(21 mmmfff 22122)(21)2()23(21 mmmfff 11)()(,(mmmmttttdttpdttuxtfhttm 有 httm 10)(dph hddt 有22122)(21)2()23(21)(mmmfffp 10)(dp01)23(21)3()2233(2122312323 mmmfff 21)2131(21)131()22331(21 mmmfff21125341223 mmmfff 10)(dp21125341223 mmmfff 1)(,
20、()()(1mmttmmdttuxtftxtx )()(1mmtxtx则:11)()(,(mmmmttttdttpdttuxtf 10)(dph 10)(dph )()(1mmtxtx 21125341223mmmfffh mmxx1 215162312 mmmfffh)(1101kmkmmmmfbfbfbhxx 0113/2-1/2223/12-16/125/12325/24-59/2437/24-9/2441901/720-2774/720 2616/720-1274/720-19/720)(11110111 kmkmmmmmfbfbfbfbhxx0111/21/225/128/12-1/
21、1239/2419/24-5/241/244251/720 646/720-264/720 106/720-19/720321,fff)9375955(243211 mmmmmmffffhxx0f)9375955(24012334ffffhxx 321,xxx1)0(,0)()(2ytyty10 t)(),(),()(22tyytftyty即 32115162312 nnnnnfffhyy)51623(121.03222121 nnnnyyyy1010020121 nnnyyy7683.0)51623(121.00212222 yyyy9087.01010020020 yy1,000yt 11
22、,1.0yt8328.01010020121 yy 22,2.0yt 33,3.0yt7132.0)51623(121.01222323 yyyy 44,4.0yt4991.0)51623(121.07282929 yyyy 1010,1 yt1 mxmt1 k 112110 mkmkkmkmxxxx )(12110 mkkmkmfffh kjkjmjkjkjmjfhx0101 kjkjmjkjkjmjmfhxx011011 1 mx kjkjmjkjkjmjmfhxx011011 mkmkmxxx、21 mkmkmfff、21 )(121101mkkmkmmxxxx )(12110 mkkm
23、kmfffh 0 k 0 k)(121101mkkmkmmxxxx )(12110 mkkmkmfffh 01101321 kkkk,)(1101kmkmmmmfbfbfbhxx )(110111kmkmmmmmfbfbfbfbhxx kjkjmjkjkjmjmfhxx011011 kjjj:0,、1)(mmxhtxR )(,()()(101101kjmkjkjmjkjkjmjmtxtfhtxhtx )()(101 kjmjkjkjmjtxhtx )(1 kjmtx1*kmtt在点)(1 kjmtx1)(mmxhtxR )()()(*)(*)1(1*0txhcthxctxcRpppkc 210
24、0)(210211kkkc )2(!121kpppkpc )2()!1(11211kppkp ,3,2 p )()()(*)(*)1(1*0thxcthxctxcRppkjjj:0,、0210 pcccc01 pc)()(2*)1(11 pppphOtxhcR010pccc122,令k)(121101101mmmmmmfffhxxxkc2100)2(!121kpppkpc)2()!1(11211kppkp,3,2p )(210211kkkc)(121101mkkmkmmxxxx)(12110mkkmkmfffh01100c0)(221011c0)2()4(212112c0)4(21861211
25、3c为独立参数令0)51()1(8)5(12)1(1111mmmmmmfffhxxx11 )51(1210)1(321)5(1212 )1(!414c)1317(!5315c时当104c时当10054cc,)4(31111mmmmmfffhxx)51()1(8)5(12)1(1111mmmmmmfffhxxx时当004c此时,)85(12111mmmmmfffhxx0)5(12124245101,)24(54111mmmmmffhxxx01100c0)(21011c0)4(21112c 0令)1(1)3(211)1(210)1()3(2)1(111mmmmmffhxxx0若取)3(211mmm
26、mffhxxkjkjmjkjkjmjfhx010101112101kkk,)取02110k)取101mkkjkjmjfhx02100kc02211kkkc0)!1()2(!1121kkkkkkkkkkc 1-111101,即通常取k11!10mmmfhxx0100c0111c 11mmmhfxx11-1122/31/3-4/3136/11-2/119/11-18/111412/253/25-16/2536/25-48/2515161k0123451377561371213760147601372001373001373001471014772147225147400147450147360kx
27、 kjkjmjkjkjmjmfhxx011011 121kxxx、121kfff、)(12110mkkmkmxxx)(12110 mkkmkmfffh 0 x1)0()(10)(xtxtx,ttexetx1010)0()(mmmhfxx1)10(mmxhxmxh)101(12)101(mxh01)101(xhm,发散,则)当11012.01hh,等幅振荡;)当2.02h,收敛。)当2.03h为复常数为复常数,型:型:时,都针对同一试验模时,都针对同一试验模讨论方法的数值稳定性讨论方法的数值稳定性为摆脱这种依赖性,在为摆脱这种依赖性,在,估计其大小很困难。,估计其大小很困难。计算误差太依赖于计算
28、误差太依赖于单步法单步法 xxtxfhtxhxxnnnn ),(),(1xfxtf ,),(mmmhfxx 1 1、前前向向欧欧拉拉法法mmmmxhxhxxEuler)1(1 式式为为用用于于试试验验模模型型的的计计算算公公前前向向:差差分分方方程程稳稳定定必必须须满满足足限限制制。性性(必必须须满满足足算算法法数数值值稳稳定定步步长长),(间间:为为实实数数时时,绝绝对对稳稳定定区区当当)20 02 hhh 211 hh,或或112 mmmhfxx、后后向向隐隐式式欧欧拉拉法法1)1(111222 hhhzj,需,需0 0 11:11 111),(间间:为为实实数数时时,绝绝对对稳稳定定区区
29、当当绝绝对对稳稳定定区区域域计计算算试试验验模模型型隐隐式式用用后后向向 hhxhxxhxxEulermmmmm)(2311 mmmmffhxx、梯梯形形公公式式122-122112222 hhhhzj,需,需同理,同理,0 )(2 11 mmmmxxhxx 计计算算试试验验模模型型mmxhxh)2(1)2-(1 1 2-121 1mmxhhx 12-121 hh),(2411mmmmmmhfxtffhxx 、改改进进欧欧拉拉法法)(2 1mmmmmxhxxhxx 计计算算试试验验模模型型mmmmxhxhxhx2)(22 2 mxhh 2)(1 2 12)(1 2 hh RK5法法、经经典典四四阶阶xfx 计计算算试试验验模模型型)(,(1mmtxtfk)2,2(12khxhtfkmm 43211226kkkkhxxmm ),(34hkxhtfkmm )2,2(23khxhtfkmm mxk 1mmmxhxhxk )21()2(2 )2(2)2(23mmmmxhxhxkhxk)22()(22234mmmmmxhxhxhxhkxkmmxhhhhx !4)(!3)(!2)(14321 1!4)(!3)(!2)(1432 hhhh长长有有何何限限制制?用用欧欧拉拉法法求求解解时时,对对步步例例:00)(5ytytyy11 h5 yf 151 h1511 h4.00 h