2.2:2.3computerhomework.docx

# 2.2:2.3computerhomework.docx - n=100...

• Homework Help
• 5

This preview shows 1 out of 3 pages.

n = 100; b(2:99) = 40; b([1,100]) = -20; b = b';  a(1:98) = 1; a(99) = -1; a = a'; d(2:99) = -4; d([1,100]) = 4; d = d'; c(1) = -1; c(2:99)=1; c = c'; y = Tri(n,a,d,c,b)';   for  i = 1:1:length(y)     fprintf( 'x(%3.0f ) = %15.10f\n' ,i,y(i)); end   function  x = Tri(n,a,d,c,b) for  i = 2:n     xmult = a(i-1)/d(i-1);     d(i) = d(i) - xmult*c(i-1);     b(i) = b(i) - xmult*b(i-1); end x(n) = b(n)/d(n); for  i = n-1:1     x(i) = (b(i)-(c(i)*x(i+1)))/d(i); end end Output: >> untitled3 x(  1 ) =    -9.28203 x(  2 ) =    -17.1281 x(  3 ) =    -19.2394 x(  4 ) =    -19.7938 x(  5 ) =    -19.9447 x(  6 ) =    -19.9851 x(  7 ) =    -19.9960 x(  8 ) =    -19.9989 x(  9 ) =    -19.9997 x( 10 ) =    -19.9999 x( 11 ) =    -19.9999 x( 12 ) =    -19.9999 x( 13 ) =    -19.9999 x( 14 ) =    -19.9999 x( 15 ) =    -19.9999 x( 16 ) =    -19.9999 x( 17 ) =    -19.9999 x( 18 ) =    -19.9999 x( 19 ) =    -19.9999

Subscribe to view the full document.

x( 20 ) =    -19.9999 x( 21 ) =    -20.0000 x( 22 ) =    -20.0000
You've reached the end of this preview.
• Fall '08
• Staff

{[ 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