{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW9 #1

# HW9 #1 - if detA~=0& rankA==4 x = A\b q1 = x(1 q2 = x(2...

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

Sheet1 Page 1 %Engineering 6, Spring 2004, Problem 9.1 %Ryan Uy, 2509 %Section B05, Tues. 3-4 % Set values for given variables pa = 4320 pb = 3600 pc = 2880 R1 = 10000 R2 = 14000 R3 = 14000 % q1 = (1/R1)(pa - p1) % q2 = (1/R2)(p1 - pb) % q3 = (1/R3)(p1 - pc) % q1 = q2 + q3 % manipulate equations to: % R1*q1 + 0*q2 + 0*q3 + 1*p1 = pa % 0*q1 + R2*q2 + 0*q3 + -1*p1 = -pb % 0*q1 + 0*q2 + R3*q3 + -1*p1 = -pc % 1*q1 + -1*q2 + -1*q3 + 0*p1 = 0 % set A = left side of manipulated equations A = [R1 0 0 1 b = [pa -pb -pc 0]' % find values for the determinant of A and the rank of A detA = det(A) rankA = rank(A) % check if solution exists: no solution if determinant = 0 or rank does not % equal number of rows in A (number of equations if detA==0 & rankA~=4 disp('No solution for given equations.') end % if there is no solution, do not execute the following code

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: if detA~=0 & rankA==4 x = A\b q1 = x(1) q2 = x(2) q3 = x(3) p1 = x(4) p1_psi = p1/144 %display commands fprintf('q1, volume flow rate in first pipe = %.5f cubic feet/second\n', q1) fprintf('q2, volume flow rate in second pipe = %.5f cubic feet/second\n', q2) Sheet1 Page 2 fprintf('q3, volume flow rate in third pipe = %.5f cubic feet/second\n', q3) fprintf('p1, pressure at the junction = %.0f pounds/square foot = %.1f psi\n', p1, p1_psi) end Sheet1 Page 3 0 R2 0 -1 0 0 R3 -1 1 -1 -1 0] % b = constant terms on right %if no solution, display message % solve using matrix division %set solutions equal to corresponding variables % find p1 in units of lbs/sq. in. Sheet1 Page 4...
View Full Document

{[ snackBarMessage ]}