Question 7.12: HEUN’S METHOD FOR SYSTEMS In Example 7.11, find an estimate ...

HEUN’S METHOD FOR SYSTEMS

In Example 7.11, find an estimate for y(0.2) by executing the user-defined function HeunODESystem.

>> x = 0:0.1:1;
>> u0 = [0;−1;1];
>> u = HeunODESystem(f,x,u0);
>> u(1,3) % y(0.2) is the 3rd entry in the first row
ans =
[latex]\boxed{−0.1810}[/latex]

The boxed value is y(0.2) = −0.1810. Recall from Example 7.11 that the (truncated) exact value is −0.181324. Therefore, the % relative error here is 0.18% as opposed to 4.785% for Euler. As expected, Heun’s method returns a more accurate approximation than Euler.

Related Answered Questions