Question

Consider the initial value problem y +y=e-, with y(0) = 0. PROJECT 1.) Find the exact solution to this equation, say 0(x). 2

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

y+y=e-- +y=e-1

comparing with standard equation

4% + p(x)y= Q(x)

here p(x)=1

Q(x)=e^{-x}

now integrating factor I=

eſ p(x)dr p(x) dx = 2 I = p

Now we are multiplying e^{x} both side of equation

dy te e * +e *y = 1

dle *y) dr

integrating both side

*y = r +C y=I* -* +C* e-

so

f(x)=c*e +cie

Matlab Code:

for i=1:40
x(i)=(1/10)*(i-1);
y(i)=exp(-x(i))*(x(i)+1);
end

plot(x,y)

0 0.5 1 1 .5 2 2.5 3 3.5

3. f=@(x) x*exp(-x)*1*exp(-x);
lv=0; // lowe value
uv=4; // upper value
invalue=1; // initial value
n=10; // value of n
YY=euler(f,lv,uv,invalue,n)
plot(YY(:,1),YY(:,2))

function E=euler(f,llimit,hlimit,ya,M)
h=(hlimit-llimit)/M;
Y=zeros(1,M+1);
T=llimit:h:hlimit;
Y(1)=ya;
for j=1:M
Y(j+1)=Y(j)+h*f(T(j));
end
E=[T' Y'];
end

4 and 5. ns=[10,20,40];
for i=1:3
f=@(x) x*exp(-x)*1*exp(-x);
lv=0;
uv=4;
invalue=1;
n=ns(i);
YY=euler(f,lv,uv,invalue,n)
plot(YY(:,1),YY(:,2))
hold on
  
end


6. f=@(x) x*exp(-x)*1*exp(-x);
lv=0;
uv=4;
invalue=1;
n=10;
YY=euler(f,lv,uv,invalue,n)
plot(YY(:,1),YY(:,2))
disp(YY)

Add a comment
Know the answer?
Add Answer to:
Consider the initial value problem y' +y=e-, with y(0) = 0. PROJECT 1.) Find the exact...
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
  • ///MATLAB/// Consider the differential equation over the interval [0,4] with initial condition y(0)=0. 3. Consider the...

    ///MATLAB/// Consider the differential equation over the interval [0,4] with initial condition y(0)=0. 3. Consider the differential equation n y' = (t3 - t2 -7t - 5)e over the interval [0,4 with initial condition y(0) = 0. (a) Plot the approximate solutions obtained using the methods of Euler, midpoint and the classic fourth order Runge Kutta with n 40 superimposed over the exact solution in the same figure. To plot multiple curves in the same figure, make use of the...

  • 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...

  • 1. Consider the IVP y = 1 - 100(y-t), y(0) = 0.5. (a) Find the exact...

    1. Consider the IVP y = 1 - 100(y-t), y(0) = 0.5. (a) Find the exact solution. (b) Use the Forward Euler, Heun, and Backward Euler methods to find approximate solu- tions ont € 0, 0.5], using h = 0.25. Plot all four solutions (exact and three approxima- tions) on the same graph. (c) Maple's approximation is plotted, along with the direction field, in Figure 1. Use it, and the exact solution, to explain the behaviours observed in your numerical...

  • di 2 y(0) = 1 Matlab. Apply Eulers method with step size h = 0.1 on...

    di 2 y(0) = 1 Matlab. Apply Eulers method with step size h = 0.1 on [0, 1] to the initial value problem listed above, in #3. a Print a table of the t values, Euler approximations, and error at each step. Deduce the order of convergence of Euler's method in this case.

  • 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...

  • Answer why the approximations are so inaccurate for this particular value of the stepsize.

    Answer why the approximations are so inaccurate for this particular value of the stepsize. Consider the IVP -2.9y, (0) 2 for 0 sts1 The exact solution of this IVP is y-2e-291 The goal of this exercise is to visualize how Euler's method is related to the slope field of the differ ential equaton. In order to do this we will plot the direction field together with the approximations and the exact solution (c) Enter the function defining the ODE as...

  • A use Euler's method with each of the following step sizes to estimate the value of y 0.4 where y...

    a use Euler's method with each of the following step sizes to estimate the value of y 0.4 where y is the solution of the initial value problem y -y, y 0 3 カー0.4 0.4) (i) y10.4) (in) h= 0.1 b we know that the exact solution of the initial value problem n part a s yー3e ra , as accurately as you can the graph of y e r 4 together with the Euler approximations using the step sizes...

  • Problem 3. Given the initial conditions, y(0) from t- 0 to 4: and y (0 0, solve the following initial-value problem...

    Problem 3. Given the initial conditions, y(0) from t- 0 to 4: and y (0 0, solve the following initial-value problem d2 dt Obtain your solution with (a) Euler's method and (b) the fourth-order RK method. In both cases, use a step size of 0.1. Plot both solutions on the same graph along with the exact solution y- cos(3t). Note: show the hand calculations for t-0.1 and 0.2, for remaining work use the MATLAB files provided in the lectures Problem...

  • Consider the initial value problem below to answer to following. a) Find the approximations to y(0.2)...

    Consider the initial value problem below to answer to following. a) Find the approximations to y(0.2) and y(0.4) using Euler's method with time steps of At 0.2, 0.1, 0.05, and 0.025 b) Using the exact solution given, compute the errors in the Euler approximations at t 0.2 and t 0.4. c) Which time step results in the more accurate approximation? Explain your observations. d) In general, how does halving the time step affect the error at t 0.2 and t...

  • To illu • The initial value problem | |-0.5 -1][g x(0) = 1, y(0) = -1...

    To illu • The initial value problem | |-0.5 -1][g x(0) = 1, y(0) = -1 is to be solved on the interval t € (0, 10] using the backward Euler method with step h = 0.01 The iteration update rule for the method is [ n+1) = (1 – hA)-- , where I is a 2 x 2 identity Lyn+1] matrix. Determine the approximate values of x(10) = (round to the fourth decimal place) and yr y(10) = (round...

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