help, pls tq.
%Matlab code for Euler and Heun's method for 2d
clear all
close all
%functions for Euler and Huen method
f=@(t,u,v) 2*v;
g=@(t,u,v) 13.*u-14.*v.^2;
%step size
h=0.1;
%Initial guess
u_0=0; v_0=1;
u_euler(1)=u_0; v_euler(1)=v_0;
t_euler(1)=0; t_end=0.2;
n=(t_end-t_euler(1))/h;
%iteration for y and z using Euler method
fprintf('Iterations for u and v using Euler method\n\n')
fprintf('Initial condition for u(0)=%f and v(0)=%f
.\n',u_0,v_0)
for i=1:n
t_euler(i+1)=t_euler(i)+h;
u_euler(i+1)=u_euler(i)+h*f(t_euler(i),u_euler(i),v_euler(i));
v_euler(i+1)=v_euler(i)+h*g(t_euler(i),u_euler(i),v_euler(i));
fprintf('After %d iteration\n',i)
fprintf('\t At t=%f\t, u(%2.2f)= %f\t v(%2.2f)=
%f\n',...
t_euler(i+1),t_euler(i+1),u_euler(i+1),t_euler(i+1),v_euler(i+1))
end
%iteration for y and z using Huen method
fprintf('\n\nIterations for u and v using Improved Euler
method\n\n')
fprintf('Initial condition for u(0)=%f and v(0)=%f
.\n',u_0,v_0)
u_huen(1)=u_0; v_huen(1)=v_0;
t_huen(1)=0; t_end=1.2;
n=(t_end-t_huen(1))/h;
for i=1:n+1
t_huen(i+1)=t_huen(i)+h;
k1=h*f(t_huen(i),u_huen(i),v_huen(i));
l1=h*g(t_huen(i),u_huen(i),v_huen(i));
k2=h*f(t_huen(i+1),u_huen(i)+k1,v_huen(i)+l1);
l2=h*g(t_huen(i+1),u_huen(i)+k1,v_huen(i)+l1);
u_huen(i+1)=u_huen(i)+(1/2)*(k1+k2);
v_huen(i+1)=v_huen(i)+(1/2)*(l1+l2);
fprintf('After %d iteration\n',i)
fprintf('\t At t=%f\t, u(%2.2f)= %f\t v(%2.2f)=
%f\n',...
t_huen(i+1),t_huen(i+1),u_huen(i+1),t_huen(i+1),v_huen(i+1))
end
%%%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%%%%
help, pls tq. 4. Consider the first order autonomous system d13-1 0)-1. (a) Estimate the solution of the system (1) at t0.2 using two steps of Euler's method with 2v, u(0)0 step-size h 0.1 T1+C2+...
An autonomous system of two first order differential equations can be written as: A third order explicit Runge-Kutta scheme for an autonomous system of two first order equations is Consider the following second order differential equation, Use the Runge-Kutta scheme to find an approximate solutions of the second order differential equation, at t = 1.2, if the step size h = 0.1. Maintain at least eight decimal digit accuracy throughout all your calculations. You may express your answer as a...
Find the value of x(0.5) for the initial value problem at = thx(0)=1 using Euler's method with step size h 0.05 Find the value of x(0.4) for the coupled first order differential equations together with initial conditions with step size 0.1: 2. dt t+x 3. dx dt = y, dy dt x(0) = 1.2 and --ty +xt2 + y(o) 0.8 Find the value of x(0.5) for the initial value problem at = thx(0)=1 using Euler's method with step size h...
An autonomous system of two first order differential equations can be written as: A third order explicit Runge-Kutta scheme for an autonomous system of two first order equations is hg(un,vn), 63-hf(un+2k2-k㎶n +212-11), 13 hg(un+2k2-ki,un +212-4), t-4 Consider the following second order differential equation, +2dy-7y2-12, with y(0)= 4 and y'(0)=0. dt2 dt Use the Runge-Kutta scheme to find an approximate solution of the second order differential equation, at t = 0.1, if the step size h = 0.05 Maintain at least...
Question 4 (1 mark) Attempt 1 Estimate the solution of the following first order autonomous system at t-1.2 using two steps of Euler's method with step-size h 0.1 Maintain at least eight decimal digit accuracy throughout all your calculations. You may express your answers as five decimal digit numbers; for example 3.17423. YOU DO NOT HAVE TO ROUND YOUR FINAL ESTIMATES.
Please have a clear hand writing :) Question Question 10 (2 marks) Special Attempt 1 Estimate the solution of the following first order autonomous system at t-0.02 using two steps of Euler's method with step-size h 0.01: du dt Maintain at least eight decimal digit accuracy throughout all your calculations. You may express your answers as five decimal digit numbers; for example 3.17423 YOU DO NOT HAVE TO ROUND YOUR FINAL ESTIMATES. v(0.02)Skipped u(0.02) Skipped Question Question 10 (2 marks)...
Problem 1 Use Euler's method with step size h = 0.5 to approximate the solution of the IVP. 2 dy ev dt t 1-t-2, y(1) = 0. Problem 2 Consider the IVP: dy dt (a) Use Euler's method with step size h0.25 to approximate y(0.5) b) Find the exact solution of the IV P c) Find the maximum error in approximating y(0.5) by y2 (d) Calculate the actual absolute error in approximating y(0.5) by /2. Problem 1 Use Euler's method...
3. Consider the following stiff system of autonomous ordinary differential equations du f(u, u) =-3u +3, u(0)2 = ' dt de g(u, v) -2000u - 1000, v(0)-3 Note that 1 u<2 and -4 <v < 3 for all t. (a) Find the Jacobian matrix for the system of equa tions (b) Find the eigenvalues of the Jacobian matrix. (c) In the figure the shaded region shows the region of absolute stability, in the complex h plane, for third order explicit...
6.3.2. A. Write the given IVP as a system. Then do two steps of Euler's method by hand (perhaps with a calculator) with the indicated step size h. Using the given exact solution, compute the error after the second step. (d) 2x2У" + 3xy'-y=0,y(1)= 4, y(1)=-1.)(x)=2(x1/2+x-1),b=1/4 6.3.2. A. Write the given IVP as a system. Then do two steps of Euler's method by hand (perhaps with a calculator) with the indicated step size h. Using the given exact solution, compute...
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
A system of two first order differential equations can be written as 0 dc A second order explicit Runge-Kutta scheme for the system of two first order equations is Consider the following second order differential equation 7+4zy 4, with y(1)-1 and y'(1)--1. Use the Runge-kutta scheme to find an approximate solution of the second order differential equation, at x = 1.2, if the step size h Maintain at least eight decimal digit accuracy throughout all your calculations You may express...