Find answers, ask questions, and connect with our <br>community around the world.

Home Forums CFD foundation course: Forum Lesson 8 (Assignment)

  • Rahul

    February 1, 2023 at 4:12 pm

    Hello Hector

    The algorithm followed for the back-substitution is to assign the values of x, starting from the last element, x(n), and going back up to x(1).
    Before beginning the for loop, the value of x(n) is assigned (in Line 30) separately, since the equation does not follow the general form of the equation for back substitution.

    Then, the for loop begins, looping for all values of i, beginning from (n-1) to 1, in descending order, with a difference of -1 between each element. Hence, i takes values, i = (n-1),(n-2),…,3,2,1. For each value of the index i, value of x(i) is evaluated using the given equation(Line 32).
    Here the values of i in the loop are in descending order because the equation for x(i) depends on x(i+1) also, which needs to be evaluated before evaluating x(i). If the for loop was executed in the ascending order, i = 1,2,3,…n-1, x(i+1) in each step would be 0(as initialized in line 29).

    This is how the back substitution algorithm is implemented in the MATLAB code.

Log in to reply.

error: Content is protected !!