re-type and modify to make it your own.
Use MATLAB\'s built in ODE solver ode23 and repeat steps 2 and 3. Sample script below. Is there any change? Only complete answers will be considered. Sample MATLAB codes and files. The suggestions below refer to an example IVP {y\' = f(t, y) = te^3t - 2y, y(t_0) = y_0 = 1, t_0 Greaterthanorequalto 0, x_0 Element Ropf. You may use the following MATLAB code s a guideline for creating a function that performs Euler\'s Re-type and modify to make it your own. %%%%% MATLAB function to perform Euler\'s method % File Name: euler-example.m % Last Mosified: Fall 2016 % Author: Dr. Flores % Purpose: Approximate the solution to the IVP y\' = f(t, y) % input variables: % (y, t, t final, h) rightarrow (\'initial value\', \'initial time\', \'final time\', \'number of time steps\') % output: W rightarrow array whose first column are time steps t_k and second % column are the approximations y(t_k). It is update after each time step. Function [w] = euler_example(y, t, t final, n) h = (t final - t)/n; % determines time-step size f = 0 (T, Y) T*exp(3*T) - 2*Y; % define the ODE w = zeros (n, 2); % pre-allocates space to store the results for i = l:n y = y + h * f (t, y); % iterative process t = t + h; % increases time step size w (i, :) = [t, y]; % Updates the result in the output variable end You can call function from the command prompt (or command line in Octave)n using the following comm. >>euler_example (1, 0, 1.2, 0.2) It is important to think about what the code above is asking MATLAB to do-solve the given IVP where f(t found in the body of the m-file with initial condition y(0) = 1. Ask you yourself, how many iterations are perfect with the user-specified time-step size h = 0.2 and final time 1.2? the following MATLAB script as a guideline for calling the built-in ODE solver.
%%%%% MATLAB function to perform Euler\'s method
% File Name: euler_example.m
%Last Modified: Fall 2016.
%Author: XYZ.
%Purpose: Approximate the solution to the IVP y\' = f(t, y)
%input variales:
%(y, t, tfinal, h)---> (\'initial value\', \'initial time\', \'final time\', \'number of time steps\')
%output: W ---> array whose first column are the time steps t_k and second
%column are the approximations y(t_k). It is updated after each time step.
function [W] = euler_example(y, t, tfinal, m)
h = (tfinal-t) / n; %determines time-step size
f = O(T, Y) T * exp(3 * T) - 2 * Y; %defines the ODE
W = zeros(n, 2); %pre-allocates space to store the results
for i = 1 : n
y = y + h * f(t, y); %iterative process.
t = t + h; %increases time step size.
W(i, :) = [t, y]; %Updates the result in the output variable.
end