Question

3In modelling the velocity y of a chain slipping off a horizontal platform, the differential equation y, 10/y-y/x is derived.

hand written solution only (not computerised) if not possible then please refund the question becs i have already recieved a computerised solution from you but i dont understand.

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

IF YOU HAVE ANY DOUBTS COMMENT BELOW I WILL BE TTHERE TO HELP YOU..ALL THE BEST.

ANSWER:

CODE:MATLAB

%%Matlab code for Euler, Improved Euler and RK4 method
clear all
close all
%Function for which solution have to do
f=@(x,y) 10./y-y./x;
hh=[0.05 0.025];

for ii=1:2
    %Euler method
    h=hh(ii);         % amount of intervals
    x=1;             % initial x
    y=1;             % initial y
    x_eval=2;        % at what point we have to evaluate
    n=(x_eval-x)/h; % Number of steps
    x2(1)=x;
    y2(1)=y;
    for i=1:n
        %Eular Steps
        m=double(f(x,y));
        x=x+h;
        y=y+h*m;
        x2(i+1)=x;
        y2(i+1)=y;
    end
    yy(ii,1)=y2(end);
    fprintf('\n\tThe solution using Euler Method for h=%.3f at x(%.1f) is %f\n',h,x2(end),y2(end))

    %Improved Euler method
    x=1;             % initial x
    y=1;             % initial y
    x_eval=2;        % at what point we have to evaluate
    n=(x_eval-x)/h; % step size
    x3(1)=x;
    y3(1)=y;
    for i=1:n
    %improved Euler steps
       m1=double(f(x,y));
       m2=double(f((x+h),(y+h*m1)));
       y=y+double(h*((m1+m2)/2));
       x=x+h;
       y3(i+1)=y;
       x3(i+1)=x;
    end
    yy(ii,2)=y3(end);
  
    fprintf('\tThe solution using improved Euler Method for h=%.3f at x(%.1f) is %f\n',h,x3(end),y3(end))
  
    %RK4 method
    x=1;             % initial x
    y=1;             % initial y
    x_eval=2;        % at what point we have to evaluate
    n=(x_eval-x)/h; % Number of steps
    x4(1)=x;
    y4(1)=y;
    for i=1:n
    %RK4 Steps
       k1=h*double(f(x,y));
       k2=h*double(f((x+h/2),(y+k1/2)));
       k3=h*double(f((x+h/2),(y+k2/2)));
       k4=h*double(f((x+h),(y+k3)));
       dx=(1/6)*(k1+2*k2+2*k3+k4);
       x=x+h;
       y=y+dx;
       x4(i+1)=x;
       y4(i+1)=y;

    end
    yy(ii,3)=y4(end);
    fprintf('\tThe solution using Runge Kutta 4 for h=%.3f at x(%.1f) is %f\n',h,x4(end),y4(end))

end
%exact solution
syms y(x)
eqn = diff(y,x) == 10/y-y/x;
cond = y(1) == 1;
y_ext(x)=dsolve(eqn,cond);

fprintf('\n\tExact solution for y(2) at x=2 is %f.\n',y_ext(2))

%Table for absolute error
fprintf('\n\n\t Absolute error of Approximations to y(2)\n')
fprintf('\tMethod        \th=0.005\th=0.025\tRatio\n\n')
v1=abs(y_ext(2)-yy(1,1)); v2=abs(y_ext(2)-yy(2,1));
fprintf('\tEuler         \t%e\t%e\t%f\n',v1,v2,v1/v2)
v1=abs(y_ext(2)-yy(1,2)); v2=abs(y_ext(2)-yy(2,2));
fprintf('\tImproved Euler\t%e\t%e\t%f\n',v1,v2,v1/v2)
v1=abs(y_ext(2)-yy(1,3)); v2=abs(y_ext(2)-yy(2,3));
fprintf('\tRunge kutta   \t%e\t%e\t%f\n',v1,v2,v1/v2)


%%Plotting solution using Euler method
figure(1)
hold on
plot(x2,y2,'Linewidth',2)
plot(x3,y3,'Linewidth',2)
plot(x4,y4,'Linewidth',2)
xlabel('x')
ylabel('y(x)')
title('Solution plot y vs. x')
legend('Euler Method','Modified Euler','RK4 Method','Location','northwest')
grid on


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

I HOPE YOU UNDERSTAND..

PLS RATE THUMBS UP..ITS HELPS ME ALOT..

THANK YOU...!!

Add a comment
Know the answer?
Add Answer to:
hand written solution only (not computerised) if not possible then please refund the question becs i have already re...
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
  • Is it possible to do this without matlab? 3In modelling the velocity y of a chain slipping off a horizontal platform, th...

    Is it possible to do this without matlab? 3In modelling the velocity y of a chain slipping off a horizontal platform, the differential equation y'- 10/y - y/x is derived. Suppose the initial condition is y (1)1 (a) Euler's method for solving y-f(x,y), y(XO-yo, is given byYn+1-yn+hf(xn,Yn) where h is a fixed stepsize, xnxo nh, and yn ~y(x). Apply one step of Euler's method to the initial value problem given above (b) Apply one step of the improved Euler method...

  • Numerical Methods for Differential Equations - Please post full correct solution!!! - need to use MATLAB...

    Numerical Methods for Differential Equations - Please post full correct solution!!! - need to use MATLAB 3. (a) Write Matlab functions to integrate the initial value problem y = f(x,y), y(a) = yo, on an interval [a, b] using: • Euler's method • Modified Euler • Improved Euler • Runge Kutta 4 It is suggested that you implement, for example, Improved Euler as [x, y) = eulerimp('f', a, yo, b, stepsize), where (2,y) = (In, Yn) is the computed solution....

  • Use Improved Euler for first question, Runge- Katta for 2nd one. Thank you In each of...

    Use Improved Euler for first question, Runge- Katta for 2nd one. Thank you In each of Problems 7 through 12, find approximate values of the solution of the given initial value problem at t-0.5,1.0, 1.5, and 2.0 (a) Use the improved Euler method with h 0.025 (b) Use the improved Euler method with h-0.0125 In each of Problems 7 through 12, find approximate values of the solution of the given initial value problem at0.5,1.0, 1.5, and 2.0. Compare the results...

  • Question 1: Given the initial-value problem 12-21 0 <1 <1, y(0) = 1, 12+10 with exact...

    Question 1: Given the initial-value problem 12-21 0 <1 <1, y(0) = 1, 12+10 with exact solution v(t) = 2t +1 t2 + 1 a. Use Euler's method with h = 0.1 to approximate the solution of y b. Calculate the error bound and compare the actual error at each step to the error bound. c. Use the answers generated in part (a) and linear interpolation to approximate the following values of y, and compare them to the actual value...

  • [7] 1. Consider the initial value problem (IVP) y′(t) = −y(t), y(0) = 1 The solution to this IVP ...

    [7] 1. Consider the initial value problem (IVP) y′(t) = −y(t), y(0) = 1 The solution to this IVP is y(t) = e−t [1] i) Implement Euler’s method and generate an approximate solution of this IVP over the interval [0,2], using stepsize h = 0.1. (The Google sheet posted on LEARN is set up to carry out precisely this task.) Report the resulting approximation of the value y(2). [1] ii) Repeat part (ii), but use stepsize h = 0.05. Describe...

  • Matlab & Differential Equations Help Needed I need help with this Matlab project for differential equations. I've got 0 experience with Matlab other than a much easier project I did in another...

    Matlab & Differential Equations Help Needed I need help with this Matlab project for differential equations. I've got 0 experience with Matlab other than a much easier project I did in another class a few semesters ago. All we've been given is this piece of paper and some sample code. I don't even know how to begin to approach this. I don't know how to use Matlab at all and I barely can do this material. Here's the handout: Here's...

  • Consider the following initial value problem у(0) — 0. у%3D х+ у, (i) Solve the differential equation above in tabul...

    Consider the following initial value problem у(0) — 0. у%3D х+ у, (i) Solve the differential equation above in tabular form with h= 0.2 to approximate the solution at x=1 by using Euler's method. Give your answer accurate to 4 decimal places. Given the exact solution of the differential equation above is y= e-x-1. Calculate (ii) all the error and percentage of relative error between the exact and the approximate y values for each of values in (i) 0.2 0.4...

  • Exercise 3 is used towards the question. Please in MATLAB coding. 1. Apply Euler's Method with...

    Exercise 3 is used towards the question. Please in MATLAB coding. 1. Apply Euler's Method with step size h=0.1 on [0, 1] to the initial value problems in Exercise 3. Print a table of the t values, Euler approximations, and error (difference from exact solution) at each step. 3. Use separation of variables to find solutions of the IVP given by y) = 1 and the following differential equations: (a) y'=1 (b) y'=1y y'=2(1+1)y () y = 5e4y (e) y=1/92...

  • Please have a clear hand writing :) Question Question 9 (2 marks) Special Attempt 1 y(0) 3. Consider the initial value p...

    Please have a clear hand writing :) Question Question 9 (2 marks) Special Attempt 1 y(0) 3. Consider the initial value problem: l Using Euler's method: yn+1ynthy n+1tn+h, with step-size h 0.05, obtain an approximate solution to the initial value problem at x- 0.1 Maintain at least eight decimal digit accuracy throughout all calculations You may express your answer as a five decimal digit number; for example 6.27181. YOU DO NOT HAVE TO ROUND YOUR FINAL ESTIMATE Estimate at x0.1...

  • Please have a clear hand writing :) Question Question 9 (2 marks) Special Attempt 1 y(0)...

    Please have a clear hand writing :) Question Question 9 (2 marks) Special Attempt 1 y(0) 3. Consider the initial value problem: l Using Euler's method: yn+1ynthy n+1tn+h, with step-size h 0.05, obtain an approximate solution to the initial value problem at x- 0.1 Maintain at least eight decimal digit accuracy throughout all calculations You may express your answer as a five decimal digit number; for example 6.27181. YOU DO NOT HAVE TO ROUND YOUR FINAL ESTIMATE Estimate at x0.1...

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