%%Matlab code for system of ODE using Euler's forward
clear all
close all
%All Parameters
%functions for Euler equation solution
f=@(u1,u2,t) u2;
g=@(u1,u2,t) 2*u2-u1+t*exp(t)-t;
%all step size
h=0.1;
%Initial values
u10=0;
u20=0;
t0=0;
%t end values
tend=1;
tn=t0:h:tend;
% Euler steps
u1_result(1)=u10;
u2_result(1)=u20;
t_result(1)=t0;
%exact solution
y_ext=@(t)
(1/6).*t.^3.*exp(t)-t.*exp(t)+2.*exp(t)-t-2;
fprintf('\t y=u1(0)=
%f\n',u1_result(1))
fprintf('\t y_ext=
%f\n\n',y_ext(t_result(1)))
for i=1:length(tn)-1
t_result(i+1)=
t_result(i)+h;
u1_result(i+1)=u1_result(i)+h*double(f(u1_result(i),u2_result(i),t_result(i)));
u2_result(i+1)=u2_result(i)+h*double(g(u1_result(i),u2_result(i),t_result(i)));
fprintf('After %d
iteration \n',i)
fprintf('\t y=u1(%2.2f)=
%f\n',t_result(i+1),u1_result(i+1))
fprintf('\t y_ext=
%f\n\n',y_ext(t_result(i+1)))
end
%plotting the solution
hold on
plot(t_result,u1_result)
plot(t_result,y_ext(t_result))
xlabel('t')
ylabel('y(t)')
title('y(t) vs. t plot')
legend('Euler solution','Exact Solution')
box on
grid on
%%%%%%%%%%%%%%%%%% End of Code
%%%%%%%%%%%%%%%%%
5. Consider the following second order IVP y2y te - t, 0 t1 y(0)/(0) 0 =...
Consider the following IVP y″ + 5y′ + y = f (t), y(0) = 3, y′(0) = 0, where f (t) = { 8 0 ≤ t ≤ 2π cos(7t) t > 2π (a) Find the Laplace transform F(s) = ℒ { f (t)} of f (t). (b) Find the Laplace transform Y(s) = ℒ {y(t)} of the solution y(t) of the above IVP. Consider the following IVP y" + 5y' + y = f(t), y(0) = 3, y'(0) =...
[7] 1. Consider the initial value problem (IVP) y′(t) = −y(t), y(0) = 1 The solution to this IVP is y(t) = e−t [1] i) Implement Euler’s method and generate an approximate solution of this IVP over the interval [0,2], using stepsize h = 0.1. (The Google sheet posted on LEARN is set up to carry out precisely this task.) Report the resulting approximation of the value y(2). [1] ii) Repeat part (ii), but use stepsize h = 0.05. Describe...
Consider the second-order IVP: t2y''+ty'-4y=-3t , t in [1,3] and y(1)=4 and y'(1)=3 Solve using Modified Euler's Method with h=1, by first transforming into a first-order IVP and solving.
Question 1: Given the initial-value problem 12-21 0 <1 <1, y(0) = 1, 12+10 with exact solution v(t) = 2t +1 t2 + 1 a. Use Euler's method with h = 0.1 to approximate the solution of y b. Calculate the error bound and compare the actual error at each step to the error bound. c. Use the answers generated in part (a) and linear interpolation to approximate the following values of y, and compare them to the actual value...
pls do all questions. thanx 1. [5 Consider the IVP rty(t) + 2 sin(t)y(t) = tan(t) y(5)=2 Does a unique solution of the IVP exist? Do not solve the IVP but fully justify you answer. What is the IOE? 2. 4 Consider the ODE Using undetermined coefficients, what is an approprite guess for the coefficient (s) in yp but fully justify you answer. ? Do not solve for 3. [10] Solve the IVP. Use any approach you like y(x) 6y'(x)...
Use Taylor's second order method to approximate the solution. y'=-5y+5t^(2)+2t, 0 ≤ t ≤ 1, y(0) = 1/3,with h = 0.1 Also, compare relative errors if the actual solution is: y=t^(2) + 1/3 * e^(-5t)
Consider the following initial value problem. y′ + 5y = { 0 t ≤ 1 10 1 ≤ t < 6 0 6 ≤ t < ∞ y(0) = 4 (a) Find the Laplace transform of the right hand side of the above differential equation. (b) Let y(t) denote the solution to the above differential equation, and let Y((s) denote the Laplace transform of y(t). Find Y(s). (c) By taking the inverse Laplace transform of your answer to (b), the...
Use the Laplace Transform to solve the IVP y" - y = 2e t, y(0) = 0, y'(0) = 1
- 2y²,y(0) =0. 1+x² 4) Consider the IVP y'= х a) Verify that y= is the solution of this IVP. 1+x? b) Use Euler's method to numerically approximate the solution to this IVP over the interval [0,2] in x. Set the mesh width h=0.1. Calculate the true values of y atthe appropriate values of x as well as the error in your numerical approximation. Report your results in the table given. Report answers to four decimal places. Numerical Actual y...
[10pt] 5. Consider the IVP :' = t +x?, *(0) = 1. Complete the following table for the numerical solutions of given IVP with step-size h = 0.05. t by Euler's Method by Improved Euler's Method 0 0.05 0.1 6. Which of the followings is the solution of the IVP