Question

Consider the following IVP dy=0.01(70-y)(50-y), with y(0)-0 (a) [10 marks Use the Runge-Kutta method of order four to obtainNumerical Methods

1 0
Add a comment Improve this question Transcribed image text
Answer #1

ка 이 = clt C40-j)(so-נג o.cs i dly - cl doo dd = 014

So-J 5 (So-3) 5 Is e-t 子0- fes 120-29 - 2 0 tS t(s Is

(c)

%%%% Matlab code %%

clc;
close all;
clear all;
format long

f=@(t,y) 0.01*(70-y)*(50-y);
y(1)=0;
h=0.5;
t=0:h:20;
y_e(1)=0;


for k=1:length(t)-1
k1=h*feval(f,t(k),y(k));
k2=h*feval(f,t(k)+h/2,y(k)+k1/2);
k3=h*feval(f,t(k)+h/2,y(k)+k2/2);
k4=h*feval(f,t(k)+h,y(k)+k3);
y(k+1)=y(k)+(k1+2*k2+2*k3+k4)/6;
  
%%% Exact solution
y_e(k+1)=350*(exp(t(k)/5)-1)/(7*exp(t(k)/5)-5);
  
  
  

  
end

%%%Error
err=abs(y_e-y);

plot(t,y_e);
hold on
plot(t,y,'*');
legend('Analytical solution','Solution by R-K method');
xlabel('t');
ylabel('y')

50 Analytical solution Solution by R-K method 45 40 35 30 25 20 15 10 0 268 10 12 14 16 18 20

Add a comment
Know the answer?
Add Answer to:
Numerical Methods Consider the following IVP dy=0.01(70-y)(50-y), with y(0)-0 (a) [10 marks Use the Runge-Kutta method of order four to obtain an approximate solution to the ODE at the points t-0.5 an...
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