Question

Consider the ODE f(x,y) = - 10r5 Take initial conditions xo = 0 , yo = y(0) = 11 , x1 = 0.2 and y y(0.2)= 22, solve for y(99)

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


Euler method for ode clear all close all %function for ode f-e (x, y) ( (x.^2)./y)-10.*x.*5; initial values y0 11 x0 0; y1-22

%%Euler method for ode
clear all
close all

%function for ode
f=@(x,y) ((x.^2)./y)-10.*x.^5;

%initial values
y0=11; y1=22;
x0=0; x1=0.2;

%step size
h=0.2;
x(1)=x1;y(1)=y1;

for i=2:99
  
    y(i)=y1+h*((3/2)*f(x1,y1)-(1/2)*f(x0,y0));
    x(i)=x1+0.2;
  
    y0=y1;
    y1=y(i);
  
    x0=x1;
    x1=x(i);
  
end

fprintf('Y(99)= %f.\n',y(end))

%%%%%%%%%%%%%% end of code %%%%%%%%%%%%

Add a comment
Know the answer?
Add Answer to:
Consider the ODE f(x,y) = - 10r5 Take initial conditions xo = 0 , yo = y(0) = 11 , x1 = 0.2 and y y(0.2)= 22, solve for...
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