# 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``` Control the questions under, representation MATLAB to rereexplain the ODE using the Runge-Kutta numerical methods. Representation tramp greatnesss h = 0.1 and h = 0.05 to abut to five decimal places the esteems x(1) and y(1). Compare the approximations with the express esteems. 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)

## Expert Confutation

```%% 4
% Reexplain x'= x + 2y  with x0=0,y'= x+ e-twith y(0)=0
y0 = 0;                  % Initial Case
h=0.1;                   % Time tramp
t = 0:h:0.05;               % t goes from 0 to 2 seconds.
yexact = x+ e ** -t     % Exact separation (in open we will not recognize this
ystar = zeros(size(t));  % Preallocate dress (good-natured coding exercitation)

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

```