1 00:00:03,297 --> 00:00:07,000 PROFESSOR: We can get to documentation for the MATLAB 2 00:00:07,000 --> 00:00:11,480 ODE Suite by entering this command at the MATLAB 3 00:00:11,480 --> 00:00:13,290 prompt-- doc ode45. 4 00:00:16,430 --> 00:00:20,240 This will bring us to an extensive documentation 5 00:00:20,240 --> 00:00:25,490 for MATLAB ode45 that includes among other things 6 00:00:25,490 --> 00:00:31,050 this chart that compares MATLAB ODE solvers. 7 00:00:31,050 --> 00:00:36,540 There are seven of them and this compares 8 00:00:36,540 --> 00:00:37,645 their various attributes. 9 00:00:40,810 --> 00:00:46,550 As we've said before, MATLAB ode45 is the workhorse. 10 00:00:46,550 --> 00:00:51,910 It's a nonstiff solver with medium accuracy 11 00:00:51,910 --> 00:00:54,620 that is the first one you should try, 12 00:00:54,620 --> 00:00:58,530 and we use it most of the time. 13 00:00:58,530 --> 00:01:03,540 I have a soft heart in my heart for MATLAB ode23. 14 00:01:03,540 --> 00:01:08,320 It's a nonstiff solver with low accuracy, 15 00:01:08,320 --> 00:01:10,370 but its accuracy that's appropriate 16 00:01:10,370 --> 00:01:17,320 for graphics work because the step size it chooses 17 00:01:17,320 --> 00:01:21,900 is appropriate for most graphics work. 18 00:01:21,900 --> 00:01:31,530 MATLAB ode113 we haven't talked about it yet, 19 00:01:31,530 --> 00:01:34,110 there could be a comma between the 1 and the 13 20 00:01:34,110 --> 00:01:36,970 here because this is a variable order 21 00:01:36,970 --> 00:01:42,170 method where the order varies all the way from 1 to 13. 22 00:01:42,170 --> 00:01:46,290 It's a multi-step method that saves history. 23 00:01:46,290 --> 00:01:52,845 If, you know about these things, it's an Adams-Moulton method. 24 00:01:55,820 --> 00:01:58,690 I associate this with worked done at Jet Propulsion 25 00:01:58,690 --> 00:02:05,290 Laboratory years ago for computing orbits of planets 26 00:02:05,290 --> 00:02:10,259 and satellites, which of course are very smooth 27 00:02:10,259 --> 00:02:12,870 and go on for years. 28 00:02:12,870 --> 00:02:20,410 It can have very high accuracy requirements. 29 00:02:20,410 --> 00:02:21,985 Then there are the stiff solvers. 30 00:02:24,900 --> 00:02:31,920 There are four of them-- 15s, 23s, and the twins, 31 00:02:31,920 --> 00:02:33,465 the trapezoid rules. 32 00:02:36,320 --> 00:02:42,750 15s is the primary stiff solver, low to medium accuracy. 33 00:02:46,610 --> 00:02:50,320 If you find ode45 is slow, taking 34 00:02:50,320 --> 00:02:55,250 lots of steps-- indication that the problem is stiff-- try 15s. 35 00:02:58,200 --> 00:03:04,050 23s can be as a low order method, low accuracy, 36 00:03:04,050 --> 00:03:08,000 and used at crude error tolerances. 37 00:03:08,000 --> 00:03:12,300 We haven't talked about mass matrices. 38 00:03:12,300 --> 00:03:14,350 This is where there's a matrix in front 39 00:03:14,350 --> 00:03:19,730 of the derivative term, and this can be used with constant mass 40 00:03:19,730 --> 00:03:21,320 matrices. 41 00:03:21,320 --> 00:03:26,490 And then the two routines with T's in their name 42 00:03:26,490 --> 00:03:29,570 are based on the trapezoidal rule, 43 00:03:29,570 --> 00:03:33,330 and they're for use with problems 44 00:03:33,330 --> 00:03:36,880 without any numerical damping. 45 00:03:36,880 --> 00:03:42,870 You can see the documentation for more details 46 00:03:42,870 --> 00:03:45,700 on the trapezoid methods. 47 00:03:45,700 --> 00:03:51,370 That's the MATLAB ODE Suite seven solvers, 48 00:03:51,370 --> 00:03:55,830 three for nonstiff problems and four for stiff problems. 49 00:03:59,020 --> 00:04:02,800 You may well get through with never using anything 50 00:04:02,800 --> 00:04:08,175 but ode45 may well serve all your needs. 51 00:04:11,710 --> 00:04:17,190 There's a second chart in the documentation that 52 00:04:17,190 --> 00:04:22,130 summarizes all the options that are available through the ODE 53 00:04:22,130 --> 00:04:24,710 Set function. 54 00:04:24,710 --> 00:04:30,370 We've briefly mentioned the tolerances, RelTol and AbsTol-- 55 00:04:30,370 --> 00:04:36,290 the output function-- these are available in all seven 56 00:04:36,290 --> 00:04:39,090 of the solvers. 57 00:04:39,090 --> 00:04:41,050 There are various other functions-- 58 00:04:41,050 --> 00:04:43,900 various other options-- available for more 59 00:04:43,900 --> 00:04:48,950 specialized work, including event handling, 60 00:04:48,950 --> 00:04:54,620 providing a Jacobian to the stiff solvers 61 00:04:54,620 --> 00:04:56,410 so they don't have to work so hard 62 00:04:56,410 --> 00:05:02,250 taking numerical differences, options 63 00:05:02,250 --> 00:05:08,460 associated with the mass matrices, 64 00:05:08,460 --> 00:05:11,430 providing a limit on the step size. 65 00:05:11,430 --> 00:05:14,460 These are all our options that can 66 00:05:14,460 --> 00:05:22,570 be specified through ode Set for more specialized work 67 00:05:22,570 --> 00:05:25,550 with the ODE solvers.