Question

help, pls tq.

4. Consider the first order autonomous system d13-1 0)-1. (a) Estimate the solution of the system (1) at t0.2 using two steps(b) An autonomous system of two first order differential equations can be written as: du dt=f(mu), u(to) = uo, dv dt=g(u, u),

4. Consider the first order autonomous system d13-1 0)-1. (a) Estimate the solution of the system (1) at t0.2 using two steps of Euler's method with 2v, u(0)0 step-size h 0.1 T1+C2+A1-4
(b) An autonomous system of two first order differential equations can be written as: du dt=f(mu), u(to) = uo, dv dt=g(u, u), u(to) to. The Improved Euler's scheme for the system of two first order equations is tn+1 = tn + h, Use the Improved Euler's scheme to find an approximate solution of the system (1) at t = 12, if the step size h = 0.1. T2+C1+A2-5
1 0
Add a comment Improve this question Transcribed image text
Answer #1

Matlab code for Euler and Heuns method for 2d clear all close all %functions for Euler and Huen method ⅝step size %Initial gu huen (i+1)-u_huen (i)+ (1/2) (k1+k2); v huen (i+1)-v_huen (i)+(1/2)*(11+12) tprint f (After %d iteration\n,1) fprint f (

%Matlab code for Euler and Heun's method for 2d
clear all
close all
%functions for Euler and Huen method

f=@(t,u,v) 2*v;
g=@(t,u,v) 13.*u-14.*v.^2;

%step size
h=0.1;

%Initial guess
u_0=0; v_0=1;

u_euler(1)=u_0; v_euler(1)=v_0;
t_euler(1)=0; t_end=0.2;
n=(t_end-t_euler(1))/h;

%iteration for y and z using Euler method
fprintf('Iterations for u and v using Euler method\n\n')
fprintf('Initial condition for u(0)=%f and v(0)=%f .\n',u_0,v_0)
for i=1:n
  
    t_euler(i+1)=t_euler(i)+h;
    u_euler(i+1)=u_euler(i)+h*f(t_euler(i),u_euler(i),v_euler(i));
    v_euler(i+1)=v_euler(i)+h*g(t_euler(i),u_euler(i),v_euler(i));
  
    fprintf('After %d iteration\n',i)
  
    fprintf('\t At t=%f\t, u(%2.2f)= %f\t v(%2.2f)= %f\n',...
        t_euler(i+1),t_euler(i+1),u_euler(i+1),t_euler(i+1),v_euler(i+1))
  
  
end

%iteration for y and z using Huen method
fprintf('\n\nIterations for u and v using Improved Euler method\n\n')
fprintf('Initial condition for u(0)=%f and v(0)=%f .\n',u_0,v_0)
u_huen(1)=u_0; v_huen(1)=v_0;
t_huen(1)=0; t_end=1.2;
n=(t_end-t_huen(1))/h;

for i=1:n+1
  
    t_huen(i+1)=t_huen(i)+h;
    k1=h*f(t_huen(i),u_huen(i),v_huen(i));
    l1=h*g(t_huen(i),u_huen(i),v_huen(i));
  
    k2=h*f(t_huen(i+1),u_huen(i)+k1,v_huen(i)+l1);
    l2=h*g(t_huen(i+1),u_huen(i)+k1,v_huen(i)+l1);
  
    u_huen(i+1)=u_huen(i)+(1/2)*(k1+k2);
    v_huen(i+1)=v_huen(i)+(1/2)*(l1+l2);
  
    fprintf('After %d iteration\n',i)
  
    fprintf('\t At t=%f\t, u(%2.2f)= %f\t v(%2.2f)= %f\n',...
        t_huen(i+1),t_huen(i+1),u_huen(i+1),t_huen(i+1),v_huen(i+1))
  
end

%%%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%%%%

Add a comment
Know the answer?
Add Answer to:
help, pls tq. 4. Consider the first order autonomous system d13-1 0)-1. (a) Estimate the solution of the system (1) at t0.2 using two steps of Euler's method with 2v, u(0)0 step-size h 0.1 T1+C2+...
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