1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: ODE solution

  1. May 26, 2013 #1
    1. The problem statement, all variables and given/known data
    Consider the following second order ODE
    $$ y'' + 2y' - y = e^{-x}, \quad y(0) = y'(0) = 1. $$ Convert this to a system of first order equations and use the pc33assisys MATLAB file to compute the solution for y(2).

    2. Relevant equations

    3. The attempt at a solution
    The system of first order equations is
    $$ u_1' = u_2 \\ u_2' = e^{-x}-2u_2+u_1 $$ with $$ u_1(0) = u_2(0) = 1. $$
    The solution for y(2) is y(2) = 3.27 to 2 d.p. But my pc33assisys file doesn't give me this. All the relevant files are attached to run the program. Can someone help figure out what is wrong with my code.


    Attached Files:

  2. jcsd
  3. May 26, 2013 #2
    There's a matrix indexing error in pc33assi3sys.m in the Adams-Moulton integration loop. Whoever wrote it also forgot to initialize f(1,:) for the first multi-step.

    I've attached a corrected version.

    Attached Files:

  4. May 26, 2013 #3
    Cheers mate
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted