Solution3

# Solution3 - Solutions ChE132B HW3 50pt Problem 1 5pt...

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

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

View Full Document

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.

Unformatted text preview: Solutions ChE132B HW3 50pt Problem 1. 5pt 10. (a) >> A=[3.02 -1.05 2.53;4.33 0.56 -1.78;-0.83 -0.54 1.47] A = 3.0200 -1.0500 2.5300 4.3300 0.5600 -1.7800 -0.8300 -0.5400 1.4700 >> b=[-1.61; 7.23; -3.38] b = -1.6100 7.2300 -3.3800 >> Ab=[A b] Ab = 3.0200 -1.0500 2.5300 -1.6100 4.3300 0.5600 -1.7800 7.2300 -0.8300 -0.5400 1.4700 -3.3800 >> Ab(3,:)=Ab(3,:)-Ab(2,:)*Ab(3,1)/Ab(2,1) Ab = 3.0200 -1.0500 2.5300 -1.6100 4.3300 0.5600 -1.7800 7.2300 0 -0.4327 1.1288 -1.9941 >> Ab(2,:)=Ab(2,:)-Ab(1,:)*Ab(2,1)/Ab(1,1) Ab = 3.0200 -1.0500 2.5300 -1.6100 0 2.0655 -5.4075 9.5384 0 -0.4327 1.1288 -1.9941 >> Ab(3,:)=Ab(3,:)-Ab(2,:)*Ab(3,2)/Ab(2,2) Ab = 3.0200 -1.0500 2.5300 -1.6100 0 2.0655 -5.4075 9.5384 0 0 -0.0040 0.0041 >> x3=Ab(3,4)/Ab(3,3) x3= -1.0197 x2 = 1.9484 >> x1=(Ab(1,4)-Ab(1,2)*x2-Ab(1,3)*x1)/Ab(1,1) x1= 0.9986 10. (b) >> A(1,1)=3.01 A = 3.0100 -1.0500 2.5300 4.3300 0.5600 -1.7800 -0.8300 -0.5400 1.4700 >> x=A\b x = 1.0600 4.1254 -0.1854 10.(c) >> A(1,1)=3.02 A = 3.0200 -1.0500 2.5300 4.3300 0.5600 -1.7800 -0.8300 -0.5400 1.4700 >> b(3,1)=-3.39 b = -1.6100 7.2300 -3.3900 >> x=A\b x = 1.1855 8.6991 1.5588 [x 1 ; x 2 ; x 3 ] % w.r.t. 10. (a) 10. (a) [0.9986; 1.9484; -1.0197] 10. (b) [1.0600; 4.1254; -0.1854] [106%; 212%; 18%] 10. (c) [1.1855; 8.6991; 1.5588] [119%; 446%; 153%] Problem 2. 10pt Annotated version of GaussPivot(A,b) Annotated version of GaussNaive(A,b) . GaussNaive(A,b) is identical to GaussPivot(A,b) except that the part that exchanges rows (i.e. pivots) at the beginning of the first for loop is omitted. A=[12 3 2 1 ; 4 11 3 2; 3 5 10 1; 2 4 6 9]; b=[2; 3; 1; 0]; x=GaussPivot(A,b) x=GaussNaive(A,b) x = 0.1189 0.2643 -0.0573 -0.1057 x = 0.1189 0.2643 -0.0573 -0.1057 Problem 3. 15pt From lecture, we know that the solution to this problem is a linear system. For N=4, and h=D/(N+1), ⎝ ⎜ ⎛ − 2 1 1 − 2 1 1 − 2 1 1 − 2 1 1 − 2 ⎠ ⎟ ⎞ ⎝ ⎜ ⎛ 1 2 3 4 5 ⎠ ⎟ ⎞ = −∆ℎ 2 ⎝ ⎜ ⎛ 1...
View Full Document

## This note was uploaded on 02/12/2012 for the course CHE 132b taught by Professor Ceweb during the Fall '09 term at UCSB.

### Page1 / 15

Solution3 - Solutions ChE132B HW3 50pt Problem 1 5pt...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online