Question: MATLAB code is required for Euler backward and trapezoidal to solve ODE for below equation: Euler forward is as below function v = f1(t,u) v=-150*u+49-150*t;

MATLAB code is required for Euler backward and trapezoidal to solve ODE for below equation:

Euler forward is as below

function v = f1(t,u) v=-150*u+49-150*t; end %actual function y=f(t,epsi) y=epsi*exp(-150*t)-t+1/3; end; epsi=0; eta = 1/3+epsi1;

function [t,u] = eulerforward(func,I,eta,n) h = (I(2)-I(1))/n; t= (I(1):h:I(2)); u(:,1) = eta; for i = 1:n; u(:,i+1) = u(:,i)+h*feval(func,t(i),u(:,i)); end end; err=norm(u-y,inf);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!