Matlab 4

Matlab 4 - Matlab 4 Leonard Harpster A06802204 C03 Exercise...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Matlab 4 Leonard Harpster A06802204 C03 Exercise 4.1 Exercise 4.2 a) 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 0 0.5 1 1.5 2 2.5 At x = 1, y = 0.2850 for h = .1 and y = 0.3284 for h = .01 At x = 2, y = 1.4700 for h = .1 and y = 1.6467 for h = .01 b) c) Euler's method gives better estimates as h decreases because the smaller the intervals over which the slope is taken, the more it approaches the actual slope. The farther from the initial point the graph goes, the more a small h differs from a large h. This is because Euler's method relies on adding each approximation to the one before it so the size of the error grows at a rate dependent on h. Exercise 4.3 a) For x = 5, y = 9.9978 for h = .1 and y = 9.9961 for h = .01 For x = 10, y = 10.0000 for h = .1 and y = 10.0000 for h = .01 b) dsolve('Dy = y*(2-y/5)', 'y(0)=1') ans = 10/(1+9*exp(-2*t)) g(5) ans = 9.9959 g(10) ans = 10.0000 c) The estimates get better as h decreases but only up to a certain point, y = 10 in this case, where they become equivalent. All solutions tend towards y = 10, so that no matter the size of h, f isn't changing, so all estimates are the same after a certain point. Exercise 4.4 The best estimate I got for y was with the h = .1, which predicted the value of y being about 2.5. This agrees with the estimate from dfield, which was about 3. Exercise 4.5 a) Except for slight periodic errors of 1/10000th the ode45 function mirrors the actual values very closely b) Euler's method is much less accurate here. ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online