Answer for (a):
clc; % Clears the screen
clear all;
h=1.5; % step size
x = 0:h:3; % Calculates up to y(3)
y = zeros(1,length(x));
y(1) = 5; % initial condition
F_xy = @(t,r) t*t- sqrt(t*r); % change the function as you desire
for i=1:(length(x)-1) % calculation loop
k_1 = F_xy(x(i),y(i));
k_2 = F_xy(x(i)+0.5*h,y(i)+0.5*h*k_1);
k_3 = F_xy((x(i)+0.5*h),(y(i)+0.5*h*k_2));
k_4 = F_xy((x(i)+h),(y(i)+k_3*h));
y(i+1) = y(i) + (1/6)*(k_1+2*k_2+2*k_3+k_4)*h; % main equation
(16 marks) Consider the initial value problem (a) Without using pre-built commands write an m-file function...
(e) Consider the Runge-Kutta method in solving the following first order ODE: dy First, using Taylor series expansion, we have the following approximation of y evaluated at the time step n+1 as a function of y at the time step n: where h is the size of the time step. The fourth order Runge-Kutta method assumes the following form where the following approximations can be made at various iterations: )sh+รู้: ,f(t.ta, ),. Note that the first term is evaluated at...
Solve the initial value problem y' = x(y - x), y(2) = 3 in the interval [2,3] using Runge Kutta fourth order with step size of h = 0.2.
please show all steps and equations used, please write neatly. Problem 16. Given the Runge-Kutta method for the initial value problem y' = f(t,y) for a
Need help with this MATLAB problem: Using the fourth order Runge-Kutta method (KK4 to solve a first order initial value problem NOTE: This assignment is to be completed using MATLAB, and your final results including the corresponding M- iles shonma ac Given the first order initial value problem with h-time step size (i.e. ti = to + ih), then the following formula computes an approximate solution to (): i vit), where y(ti) - true value (ezact solution), (t)-f(t, v), vto)...
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...
MATLAB HELP 3. Consider the equation y′ = y2 − 3x, where y(0) = 1. USE THE EULER AND RUNGE-KUTTA APPROXIMATION SCRIPTS PROVIDED IN THE PICTURES a. Use a Euler approximation with a step size of 0.25 to approximate y(2). b. Use a Runge-Kutta approximation with a step size of 0.25 to approximate y(2). c. Graph both approximation functions in the same window as a slope field for the differential equation. d. Find a formula for the actual solution (not...
The Program for the code should be matlab 5. [25 pointsl Given the initial value problem with the initial conditions y(0) 2 and y'(0)10, (a) Solve analytically to obtain the exact solution y(x) (b) Solve numerically using the forward Euler, backward Euler, and fourth-order Runge Kutta methods. Please implement all three methods yourselves do not use any built- in integrators (i.e., ode45)). Integrate over 0 3 r < 4, and compare the methods with the exact solution. (For example, using...
Consider a cylindrical storage tank with surface area A which contains a liquid at depth y:At time t = 0, the tank is empty (y = 0 when t = 0). Liquid is supplied to the tank at a sinusoidal rate Qin =3Qsin2 (t) and withdrawn from the tank as: 𝑄𝑜𝑢𝑡 = 3(𝑦 − 𝑦𝑜𝑢𝑡) 1.5 if 𝑦 > 𝑦𝑜𝑢𝑡 𝑄𝑜𝑢𝑡 = 0 if 𝑦 ≤ 𝑦𝑜𝑢𝑡 Please note that both 𝑄𝑖𝑛 and 𝑄𝑜𝑢𝑡 have units m3 /h. The mass...
Question 11 (2 marks) Special Attempt 2 I value problem: y'4y+3 Consider the initial value problem: y'-43 Using TWO(2) steps of the following explict third order Runge-Kutta scheme 1hyn 2 obtain an approximate solution to the initial value problem at x 0.04. Maintain at least eight decimal digit accuracy throughout all your calculations. You may express your answer as a single five decimal digit number, for example 17.18263. YOU DO NOT HAVE TO ROUND YOUR FINAL ESTIMATE. y(0.04) Skipped Question...
462 1.231251937 4 Yy-2(3)(1.061616 237712 4. Given the initial value problem and exact solution: a) Verify the solution by the method of Undetermined Coefficients. x-y+2 y(0)4 ()3e +x+1 (10 points) b) Apply the Runge-Kutta method to approximate the solution on the interval [0.0.5] with step size [15 points h = 0.25 . Construct a table showing six-decimal-place values of the approximate solution and actual solution at each step