Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Today you will use Euler's method to numerically solve an ordinary differential equation given an initial value. The method is also covered in section 4.3
Today you will use Euler's method to numerically solve an ordinary differential equation given an initial value. The method is also covered in section 4.3 of the lecture workbook. To use Euler's method to numerically solve the initial value problem: = f(t,y) with initial condition y(to) = you we do the following: 1. Start at the point (to, yo). 2. Calculate the slope at the current point,f(toyo). 3. Move along the slope field to calculate the next point (t1, y) as t1 = to + At, y = yg + Atto, y) = y + Atf(to,yo). dy 4. Continue calculating more points with ti+1 = t; + At, Yi+1 = yg +Att,y;) = y; + Atf(t;,y;) until you reach the final t value at which you want to know the approximate value of your solution y. Exercise 2 Consider the Initial Value Problem (IVP): dy=f(t,y), yO) = 1 where f(t, y) = 1 --4 - 2y An example Matlab code that uses Euler's method to numerically find a solution to this IVP is provided in Code Snippet 1. Show/hide Code Snippet 1 Answer the following questions about Code Snippet 1. The initial condition is y(0) = 1. Explain why we don't put t(0) = 0 and Y(0) = 1: Enter explanation What was the implemented step-size, Al? Enter value Without running the code Snippet in Matlab see if you can determine what t(11) will be: t(11) = Enter value Show/hide Code Snippet 1 NPOL COUW t = zeros (1,10+1); y = zeros (1,10+1); t(1) = 0; Y(1) = 1; dt = 0.2; for k = 1:10 t(k+1) = t(k)+dt; y(k+1) = y(k)+dt*(1-exp(-4*t(k))-2*y()); end plot(t,y,'ro-') t(end) y (end) What was the implemented step-size, Ar? Enter value Without running the code Snippet in Matlab see if you can determine what t(11) will be: t(11) = Enter value Describe the meaning of y(11): Enter answer Now create and run an M-file containing the code snippet. From the plot, how accurate do you think the answer for y(11) is? How could you make it more accurate? Enter
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started