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

Write a MATLAB function that performs one step for the ODE given in Eqn 1 using

ID: 2086898 • Letter: W

Question

Write a MATLAB function that performs one step for the ODE given in Eqn 1 using the implicit Euler method. The function header should be function [ynewm xnew] - Imp Euler_Step(yold,xold,dx) where the return values are .ynew-the estimate of the solution at the new step, xnew - the new x-value, and the input parameters are: yold-the current value of the solution, .xold- the current value of x dx-the step size NOTE: because of the nature of the implicit method, it is much harder to pass in the RHS as a function handle. Thus for the implicit method, you will need to hard-code the RHS function into the Imp_Euler_Step code.

Explanation / Answer

Matlab Code:

function [ynew xnew]= Imp_Euler_Step(yold,xold,dx)
clc;

% add your function here( differential equation as a funtion of x and y)
f=@(x,y)3*x^2+4*y;

%solving
xnew=xold+dx;
y=yold+dx*(f(xold,yold));
ynew=yold+dx*f(xnew,y);

__________________________

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