Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem #1: Heun\'s Method (with iteration) is an improved numerical method used

ID: 1841644 • Letter: P

Question

Problem #1: Heun's Method (with iteration) is an improved numerical method used to integrate functions A.) Describe the theory of Heun's Method (with iteration) by explaining key equations. B.) a Matlab script that is capable of numerical integration using Heaun's Method (with iteration). C.) Use your Matlab script to numerically integrate the following differential equation from 0 to x 4 with a step size of 1 dy 0.88 x 0.5 4e dx The initial condition is y(0) 2. Plot the solutions of the analytical, Euler's, and Heun's methods on the same plot. Also, include a printout of your Heun's method Matlab script and be able to execute the script in front of the instructor. NOTE: You should use approximate relative error, Ea, to determine your tolerance for your calculated y values. C ration present value previous value present value

Explanation / Answer

For a differential eqn:

y = f(x, y)

y(xo) = yo

the Heun's method iterative formula is as follows:

xn+1 = xn + h

yn+1 = yn + (h/2) (f(xn, yn) + f(xn + h, yn +  h f(xn, yn)))

The Matlab code is given below:

function [f]=fn(x,y)
f=4*exp(0.8*x)-0.5*y;
end

% define function fn as per the differential equation sepaately.
%step size;h
h=1;
%initial condition y(0)=2
x(1)=0;
y(1)=2;
% no of iterations n=4
for n=1:4
x(n+1)=x(n)+h;
k=fn(x(n),y(n));
y(n+1)=y(n)+h/2*k+fn((x(n)+h),(y(n)+h*k));
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote