Chapter 8 Section 85 Question o6c Determine approximate valu
Chapter 8, Section 8.5, Question o6c Determine approximate values of the solution x- 4 (t), y- (t) of the given initial value problem at t 0.2, 0.4, 0.6, 0.8, and 1.0 use the Runge-Kutta method with h 0.1 sin(x 4 y), x(0) 1, y( 0 COS X, Use a computer or graphing calculator to solve this problem. Round your an swers to five decimal places. n 6 n m 4 n 10 02 0.4 06 08 1.0
Solution
Solution for Question 1
code
1) First create a function and save it as f1.m
contents of f1:
function dydt = f1(t,y)
dydt = [exp(-y(1)+ y(2))- cos(y(1)); sin(y(1)-4*y(1))];
end
2) Set Options for ode45 solver
opts_1 = odeset(\'InitialStep\',0.1,\'MaxStep\',0.1);
3)Solve DE as
[t,y]=ode45(@f1,[0 5],[1;3],opts_1);
y gives vector whose first column are value of X and second column are value of Y. To find value at point any instant t0:
sol= y((t==t0),:)
| t | 0.2 | 0.4 | 0.6 | 0.8 | 1 |
| x | 1.9845 | 2.5331 | 2.9824 | 3.3323 | 3.6393 |
| y | 3.1409 | 3.0527 | 2.8871 | 2.8987 | 3.0653 |
