sol_hw5 - CE 335 Solutions to Homework 5 11 We need to...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CE 335 Solutions to Homework 5 11) We need to assume that all material supplied is used. Augmented matrix formulation of problem: 15 17 19 | 3890 1.0 1.2 1.5 | 282 0.3 0.4 0.55 | 95 subtract multiple of first row from second and third (in Matlab: A(2, :) = A(2, :) - (A(2, 1 )/A(1, 1))*A(1, :); A(3, :) = A(3, :) - (A(3, 1)/A(1, 1))*A(1, :) ): 15 17 19 | 3890 0 1/15 7/30 | 68/3 0 0.06 0.17 | 17.2 subtract a multiple of the second row from the third (in Matlab: A(3, :) = A(3, :) - (A(3, 2 )/A(2, 2))*A(2, :) ): 15 17 19 | 3890 0 1/15 7/30 | 68/3 0 0 -0.04 | -3.2 with back-substitution, we now get x 3 = 80, x 2 = 60, x 1 = 90 for the number of each component that can be produced per day. 12) We use the finite-difference approximations c''(x) ≈ (c(x + h) - 2c(x) + c(x - h)) / h 2 c'(x) ≈ (c(x + h) - c(x - h)) / 2h so from the differential equation (D/h 2 )(c(x + h) - 2c(x) + c(x - h)) - (U/2h)(c(x + h) - c(x - h)) - kc(x) ≈ 0 Taking, for example, h = 0.5, we consider 21 values of c between x = 0 and x = 10, where c(0) and c(10 ) are known. The system of linear equations is tridiagonal. D = 2; U = 1; k = 0.2; n = 21; h = 0.5; h2 = h^2; A = zeros(n); A(1, 1) = 1; for i = 2:(n - 1) A(i, i - 1) = (D/h2) + (U/(2*h));
Image of page 1

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

View Full Document Right Arrow Icon
A(i, i) = -2*D/h2 - k; A(i, i + 1) = (D/h2) - (U/(2*h)); end A(n, n) = 1; b(1) = 80; b(2:(n - 1)) = 0; b(n) = 20; c = A \ b;
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern