Question

Consider the following initial value problem:

y(t) ly(0) 3 1.2y7e0.3 te [0, 1.5

1. Use Euler's explicit scheme to solve the above initial value problem with time step h= 0.5. Express all the computed results with a precision of three decimal places.

2. The analytical or exact solution is 43 -1.2t 70 -0.3t -e y = 9 -e 9 compute the absolute error at each tivalue. Express all the computed results with a precision of three decimal places.

3. Write a matlab function that solves the above (IVP) using (RK2.M) for arbitrary time-step h.

y(t) ly(0) 3 1.2y7e0.3 te [0, 1.5
43 -1.2t 70 -0.3t -e y = 9 -e 9
0 0
Add a comment Improve this question Transcribed image text
Answer #1

-. 2 teo,1.5] 3 Euler method (1) 0.3t fa.9)12y7 h-0.5 at to-0, yo-3 J@>3 Stepo 0. 3x 0.5 =3+05 (-3.6+9) 3t7 7.5)400 り、th ftツ)stp y h ,y,) O 3A 4.S92t 0.5 (-12 x 4.9 - y)449 I+0 S-/.5 -(.2t 3t Le3e Givan analytul casluton is 0.3x0.5 u312 Kos-4.072 3 (

Part 3: MATLAB CODE

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all
clc;
format short
f=@(t,y)(-1.2*y+7*exp(-0.3*t));   
h=0.5; % arbitrary h value you may change any value accordingly result will be displayed
t = 0:h:1.5;
y = zeros(1,length(t));
y(1)=3; % index has been taken as i instead of 0

for n=1:(length(t)-1)
k1=h*f(t(n),y(n));
k2=h*f(t(n)+h,y(n)+k1);
  
y(n+1)=y(n)+(1/2)*(k1+k2);
end

t_y=[t' y'] % Solution of ODE at t=0 to 1.5

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

OUTPUT for h=0.5 (you may change h)

t_y =

0 3.0000
0.5000 3.9462
1.0000 4.1877
1.5000 4.0633

Add a comment
Know the answer?
Add Answer to:
Consider the following initial value problem: 1. Use Euler's explicit scheme to solve the above initial value probl...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT