# Homework Solution: For the questions below, use MATLAB to solve the ODE using the Runge-Kutta numerical metho… For the questions below, use MATLAB to solve the ODE using the Runge-Kutta numerical methods. Use step sizes h = 0.1 and h = 0.05 to approximate to five decimal places the values x(1) and y(1). Compare the approximations with the actual values. X' = x + 2 y x(0) = 0 y' = x + e^-t y(0) = 0 x(t) = 1/9 (2e^2t - 2e^-t + 6e^-t) y(t) = 1/9(e^2t - e^-t + 6te^-t)

```%% 4
% Solve x'= x + 2y  with x0=0,y'= x+ e-twith y(0)=0``` Coercion the questions underneath, reason MATLAB to work-out the ODE using the Runge-Kutta numerical methods. Reason stride bignesss h = 0.1 and h = 0.05 to near to five decimal places the treasures x(1) and y(1). Compare the approximations with the objective treasures. X’ = x + 2 y x(0) = 0 y’ = x + e^-t y(0) = 0 x(t) = 1/9 (2e^2t – 2e^-t + 6e^-t) y(t) = 1/9(e^2t – e^-t + 6te^-t)

```%% 4
% Work-out x'= x + 2y  with x0=0,y'= x+ e-twith y(0)=0
y0 = 0;                  % Initial Requisite
h=0.1;                   % Time stride
t = 0:h:0.05;               % t goes from 0 to 2 seconds.
yexact = x+ e ** -t     % Exact discontinuance (in unconcealed we will not recognize this
ystar = zeros(size(t));  % Preallocate accoutre (amiable coding action)

ystar(1) = y0;           % Initial requisite gives discontinuance at t=0.
coercion i=1:(length(t)-1)
k1 = 1/9(2*e ** 2*t - 2*e** -t + 6^ e** -t) ;             % Approx coercion y gives approx coercion deriv
y1 = 1/9(e ** 2*t - e** -t + 6^t* e** -t);
```
```        % Moderate treasure
k2 = x+2*y;                    % Approx deriv at moderate treasure.
ystar(i+1) = x+e**-t; % Near discontinuance at present treasure of y
end

```