(c)
%%%% Matlab code %%
clc;
close all;
clear all;
format long
f=@(t,y) 0.01*(70-y)*(50-y);
y(1)=0;
h=0.5;
t=0:h:20;
y_e(1)=0;
for k=1:length(t)-1
k1=h*feval(f,t(k),y(k));
k2=h*feval(f,t(k)+h/2,y(k)+k1/2);
k3=h*feval(f,t(k)+h/2,y(k)+k2/2);
k4=h*feval(f,t(k)+h,y(k)+k3);
y(k+1)=y(k)+(k1+2*k2+2*k3+k4)/6;
%%% Exact solution
y_e(k+1)=350*(exp(t(k)/5)-1)/(7*exp(t(k)/5)-5);
end
%%%Error
err=abs(y_e-y);
plot(t,y_e);
hold on
plot(t,y,'*');
legend('Analytical solution','Solution by R-K method');
xlabel('t');
ylabel('y')
Numerical Methods Consider the following IVP dy=0.01(70-y)(50-y), with y(0)-0 (a) [10 marks Use the Runge-Kutta method of order four to obtain an approximate solution to the ODE at the points t-0.5 an...
step Consider the IVP y = 1 + y?, y(0) = 0 a. Use the Runge-Kutta Method with step size 0.1 to approximate y(0.2) b. Find the error between the analytic solution and the approximate solution at each step
Given (dy/dx)=(3x^3+6xy^2-x)/(2y) with y=0.707 at x= 0, h=0.1 obtain a solution by the fourth order Runge-Kutta method for a range x=0 to 0.5
Consider the IVP, 1. Apply the FEUT to show that a solution exists. 2. Use the Runge-Kutta method with various step-sizes to estimate the maximum t-value, t=t∗>0, for which the solution is defined on the interval [0,t∗). Include a few representative graphs with your submission, but not the lists of points. 3. Find the exact solution to the IVP and solve for t∗ analytically. How close was your approximation from the previous question? 4. The Runge-Kutta method continues to give...
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...
Runge-Kutta method R-K method is given by the following algorithm. Yo = y(xo) = given. k1-f(xy) k4-f(xi +h,yi + k3) 6 For i = 0, 1, 2, , n, where h = (b-a)/n. Consider the same IVP given in problem 2 and answer the following a) Write a MATLAB script file to find y(2) using h = 0.1 and call the file odeRK 19.m b) Generate the following table now using both ode Euler and odeRK19 only for h -0.01....
MATLAB help please!!!!! 1. Use the forward Euler method Vi+,-Vi + (ti+1-tinti , yi) for i=0.1, 2, , taking yo-y(to) to be the initial condition, to approximate the solution at 2 of the IVP y'=y-t2 + 1, 0 2, y(0) = 0.5. t Use N 2k, k2,...,20 equispaced timesteps so to 0 and t-1 2) Make a convergence plot computing the error by comparing with the exact solution, y: t (t+1)2 exp(t)/2, and plotting the error as a function of...
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...
///MATLAB/// Consider the differential equation over the interval [0,4] with initial condition y(0)=0. 3. Consider the differential equation n y' = (t3 - t2 -7t - 5)e over the interval [0,4 with initial condition y(0) = 0. (a) Plot the approximate solutions obtained using the methods of Euler, midpoint and the classic fourth order Runge Kutta with n 40 superimposed over the exact solution in the same figure. To plot multiple curves in the same figure, make use of the...
Solve using Matlab Use the forward Euler method, Vi+,-Vi+(4+1-tinti ,Vi) for i= 0,1,2, , taking yo y(to) to be the initial condition, to approximate the solution at t-2 of the IVP y'=y-t2 + 1, 0-t-2, y(0) = 0.5. Use N = 2k, k = 1, 2, , 20 equispaced time steps (so to = 0 and tN-1 = 2). Make a convergence plot, computing the error by comparing with the exact solution, y: t1)2 -exp(t)/2, and plotting the error as...
Using the Runge-Kutta fourth-order method, obtain a solution to dx/dt=f(t,x,y)=xy^3+t^2; dy/dt=g(t,x,y)=ty+x^3 for t= 0 to t= 1 second. The initial conditions are given as x(0)=0, y(0) =1. Use a time increment of 0.2 seconds. Do hand calculations for t = 0.2 sec only.