Lab3 - Lab 3 Higher-Order Numerical Methods Goals In this...

This preview shows pages 1–4. Sign up to view the full content.

Lab 3: Higher-Order Numerical Methods Goals In this lab you will compare the order of accuracy of various numerical methods; that is, you will test-drive some new solvers. You will implement an improved Euler’s method and a fourth-order Runge-Kutta method, in addition to your Euler’s method program from Lab 2. The example from Lab 2 of an RC circuit with AC voltage provides a case-study for comparing these three methods. Prelab assignment Before arriving in the lab, answer the following questions. You will need your answers in lab to work the problems, and your recitation instructor may check that you have brought them. These problems are to be handed in as part of your lab report. Consider the initial-value problem Q ( t ) = - 1 2 Q ( t ) + 5 , Q (0) = 2 . (1) 1. Solve this problem for Q ( t ) by noting that the differential equation is separable. 2. Table 1 below shows the resulting values from N steps of some numerical method to approximate Q ( t ) over the interval 0 t 2. Copy the table and fill in the exact values using your solution. 3. Calculate the errors and write them in Table 1. Note that error means | approximate - exact | . Also copy Table 2 and fill in the errors (only for t = 2). 4. The step size h is obtained by dividing the interval over which the solution is computed into N equal parts. Calculate the step sizes h for the three rows in Table 2. 5. Plug in the values from Table 2 into the following equations, E 1 = Ch α 1 and E 2 = Ch α 2 and solve them for the exponent α . Hint: taking logarithms makes the equations easier to solve. 6. Repeat the computations of question 5 using the values h 2 , h 3 and E 2 , E 3 instead of h 1 , h 2 and E 1 , E 2 . The value of α you obtain should be close to that obtained in question 5; you are repeating the computation as a check on your previous calculation. 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
7. Based on your answers to questions 5 and 6 which numerical method do you think was used? (Refer to sections 2.5 and 2.6 of the textbook.) t Approximate Q Exact Q Error N = 10 1 . 0 5 . 143393877 2 . 0 7 . 051672121 N = 60 1 . 0 5 . 147640987 2 . 0 7 . 056826501 N = 360 1 . 0 5 . 147751596 2 . 0 7 . 056960678 Table 1: Approximate Solution to the initial-value problem (1) N h Error 10 h 1 = E 1 = 60 h 2 = E 2 = 360 h 3 = E 3 = Table 2: Errors for t = 2 2
In the lab In this lab we will see how higher-order numerical methods can be implemented in Matlab as easily as Euler’s method was implemented in Lab 2. We are still concerned with the general initial-value problem dy dt = f ( t, y ) , y ( a ) = y 0 . (2) In Lab 2 you implemented a solver for this initial-value problem using Euler’s method. In

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern