Consider the following initial value problem:
1. Use Euler's explicit scheme to solve the above initial value problem with time step h= 0.5. Express all the computed results with a precision of three decimal places.
2. The analytical or exact solution is compute the absolute error at each tivalue. Express all the computed results with a precision of three decimal places.
3. Write a matlab function that solves the above (IVP) using (RK2.M) for arbitrary time-step h.
Part 3: MATLAB CODE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
clc;
format short
f=@(t,y)(-1.2*y+7*exp(-0.3*t));
h=0.5; % arbitrary h value you may change any value accordingly
result will be displayed
t = 0:h:1.5;
y = zeros(1,length(t));
y(1)=3; % index has been taken as i instead of 0
for n=1:(length(t)-1)
k1=h*f(t(n),y(n));
k2=h*f(t(n)+h,y(n)+k1);
y(n+1)=y(n)+(1/2)*(k1+k2);
end
t_y=[t' y'] % Solution of ODE at t=0 to
1.5
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OUTPUT for h=0.5 (you may change h)
t_y =
0 3.0000
0.5000 3.9462
1.0000 4.1877
1.5000 4.0633
Consider the following initial value problem: 1. Use Euler's explicit scheme to solve the above initial value probl...
Consider the following initial value problem: 1. Use Euler's explicit scheme to solve the above initial value problem with time step h= 0.5. Express all the computed results with a precision of three decimal places. 2. The analytical or exact solution is compute the absolute error at each ti value. Express all the computed results with a precision of three decimal places. 3. Write a matlab function that solves the above (IVP) using (RK2.M) for arbitrary time-step h. 0.3t 43...
Consider the initial-value problem yl =0.3y y(3) = 0.2 (a) Use Euler's method to estimate y (-2with step size h 0.5 Give your approximation for y (-2)with a precision of ±0.01 y(2) Number (b) Use Euler's method to estimate y (-2)with step size h = 0.25 Give your approximation for y (-2)with a precision of ±0.01 y (-2) Number Consider the initial-value problem yl =0.3y y(3) = 0.2 (a) Use Euler's method to estimate y (-2with step size h 0.5...
Consider the initial-value problem y' = 2x – 3y + 1, y(1) = 9. The analytic solution is 1 2 74 e-3(x - 1). 9 3 9 (a) Find a formula involving c and h for the local truncation error in the nth step if Euler's method is used. 372²e -3(0-1) (b) Find a bound for the local truncation error in each step if h = 0.1 is used to approximate y(1.5). (Proceed as in Example 1 of Section 6.1.)...
MATLAB CODE: Task 2 8y dt Solve the above ordinary differential equation (ODE) using Euler's method with step sizes of: 2. h 0.75 3. h 0.5 4. h 0.001 a) For each step size, plot the results at each step starting from y(0) 3 to y(3). b) Plot on the same figure as part a) the analytical solution which is given by: 9 24 -8t c) Calculate and print the percentage error between the Euler's method and the analytical result...
Consider the initial-value problem y' = 2x - 3y + 1, y(1) = 9. The analytic solution is 1 2 74 -X + e-3(x - 1) 9 (a) Find a formula involving c and h for the local truncation error in the nth step if Euler's method is used. (b) Find a bound for the local truncation error in each step if h = 0.1 is used to approximate y(1.5). (Proceed as in Example 1 of Section 6.1.) (c) Approximate...
VOX) + Consider the initial value problem y' - 2x - 3y + 1, y(1) 9. The analytic solution is 1 2 74 + -3x - 1) 3 9 (a) Find a formula involving c and h for the local truncation error in the nth step if Euler's method is used. (b) Find a bound for the local truncation error in each step ith-0.1 is used to approximate y(1.5). (Proceed as in Example 1 of Section 6.1.) (c) Approximate y(1.5)...
I. Use Euler's method with step size h = 0.1 to numerically solve the initial value problem y,--2ty+y2, y(0) 1 on the interval 0 < t 2. Compare your approximations with the exact solution. I. Use Euler's method with step size h = 0.1 to numerically solve the initial value problem y,--2ty+y2, y(0) 1 on the interval 0
Complete using MatLab 1. Consider the following initial value problem 3t2-y, y(0) = 1 Using Euler's Method and the second order Runge-Kutta method, for t E [0, 1] with a step size of h 0.05, approximate the solution to the initial value problem. Plot the true solution and the approximate solutions on the same figure. Be sure to label your axis and include an a. appropriate legend b. Verify that the analytic solution to the differential equation is given by...
Consider the initial value problem: 50 y' = - 50y, te [0, 100), y(0) = V2. Y Through computational experimentation, one deduces that the solution y(t) decreases monotonically starting at 2 and asymptotically approaches 1 as t +0. (a) [6pts.] Assume the Euler's method is used to solve this problem. The interval of absolute stability for the Euler's method is (-2,0). What is stability restrictions on step size h using Euler's method?
-1.2y 7e-03* from x tox 2.0 with the 2) Use Euler's method to solve the ODE initial condition y3 at x0 dx a) Solve by hand using h b) Write a MATLAB program in a script file that solves the equation using h-0.1 and find y(1.5). c) Use the program from part (b) to solve the equation using h= 0.01 and h = 0.001 and findy(1,5). 0.5 and find y(2). d) The exact solution to the IVP is given by...