Linear Systems of Equations
Supplemental Instruction
Iowa State University / Leader: / Matt T.
Course: / ChE 310
Instructor: / Clapp
Date: / 9/8/11

1. Put the following system of equations into A x = b form.

7*z - p + 2*q = 10

p - 3*q + y/2 + 3*x = 10

q - x + q - 2*y = -3

-y + 3*x - 3*p - 1/3*q = 3

z + x + y = 8

2. (40 points) Consider the following process flow diagram for producing a species B:

a. (16 points) Assuming the conversion of A is 50% inside the reactor (remember that conversion of A = (moles A in – moles A out)/moles A in, or moles A consumed/moles A fed), and that the system is at steady-state, write down four appropriate mass balance equations required to solve for the four unknown variables in the system.

b. (5 points) Convert the system of equations into the matrix form A x = b.

c. (15 points) Show, using a very short MATLAB script m-file, how to efficiently use built-in functions to solve for the matrix x

3. Develop a MATLAB function m-file called cramer.m that takes the below form and satisfies the following conditions:

·  Solves for the matrix x when passed the coefficient matrix A and constant vector b.

·  Uses Cramer’s Rule to solve for each element of variable vector x.

·  Does include the “\” character.

function x = cramer(A,b)

end