Question: this is a MATLAB question. Do not answer if you are not sure on how to do it correct. I have this matlab-code that solves

this is a MATLAB question. Do not answer if you are not sure on how to do it correct.
I have this matlab-code that solves the forward euler of a differential equation (see picture). I need help to write a Matlab-code for the backward euler of this differential equation.
the exact solution of the differentail equation is : (1/65)*(93*exp(-2*t)-15*cos(3*t)+10*sin(3*t))
n=5;
for j=1:4
h=8
t=0:h:8;
y=zeros(size(t));
y(1)=1.2;
m=numel(y);
exactsol=(1/65)*(93*exp(-2*t)-15*cos(3*t)+10*sin(3*t));
for i=1:m-1
f=sin(3*t(i))-2*y(i);
y(i+1)=y(i) + h*f;
end
n = n*2;
e1(j)=h;
e(j)=norm(exactsol-y);
plot (t,y)
hold on
end
plot(t,exactsol);
title('Exakta solution and the four euler solutions')
legend ('n=5','n=10','n=20','n=40')
 this is a MATLAB question. Do not answer if you are
not sure on how to do it correct. I have this matlab-code

= sin(3+) 2y, y(0) = 1.2, t [0,8). dt n=5; for j=1:4 h=8 t=0:h:8; y=zeros(size(t)); y (1)=1.2; m=numel(y); exactsol=(1/65)*(93*exp(-2*t)-15*cos(3*t) +10*sin (3*t)); for i=1:m-1 f=sin( 3*t(i))-2*y(i); y(i+1)=y (i) + h*f; end n = n*2; el(j)=h; e(j)=norm(exactsol-y); plot (t,y) hold on end plot(t, exact sol); title('Exact solution and the four euler solutions') legend (n=5', 'n=10', 'n=20', 'n=40')

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!