Homework Solution: Consider the process flow diagram shown in Fig. 2.14. We can write this out as the system of equation…

    2.80 Consider the process llow diagrarm shown in Fig. 2.14. We can write this out as the system of equations m1 m2 + m3 + m4 + m5 mi = 100 0.84m 12 = m4 + m7 0.7ml = m2 + m3 0.55mm + m12 0.2m9 = m10 0.85m2 m9 + m11 The first four equations are the mass balances; the next eight equations are the process specifications 2 10 4 12 6 Figure 2.14 Proccss schcmatic for Problem 2.80 (a) Write a MATLAB program that generates the matrix A and vector b required to solve the problem for this set of equations (b) Write a MATLAB program that solves this system using naive Gauss elimination. What happens? How do you fix it?
    Consider the process flow diagram shown in Fig. 2.14. We can write this out as the system of equations m1 = m2 + m3 + m4 + m5 m_2 = m_9 + m_10 + m_11 m_5 = m_8 + m_7+m_6 m_12 = m_4 + m_7 + m_11 m_1 =100 m_5 = 5 ms 0.84 m_12 = m_4 + m_7 0.7 m_1 = m_2 + m_3 0.55 m_1 = m_9 + m_12 0.2 m_9 = m_10 0.85m_2 = m_9 + m_11 3.2 m_6 = m_7 + m_8 The first four equations are the mass balances: the next eight equations are the process specifications. (a) Write a MATLAB program that generates the matrix A and vector b required to solve the problem for this set of equations. (b) Write a MATLAB program that solves this system using naive Gauss elimination. What happens? How do you fix it?

    Expert Answer

     
    From the given equations A 12x12 matrix is: 1 -1 -1 -1 -1 0 0 0 0 0 0 0

    2.80 Consider the arrangement llow diagrarm shown in Fig. 2.14. We can transcribe this quenched as the order of equations m1 m2 + m3 + m4 + m5 mi = 100 0.84m 12 = m4 + m7 0.7ml = m2 + m3 0.55mm + m12 0.2m9 = m10 0.85m2 m9 + m11 The primitive four equations are the magnitude balances; the direct eight equations are the arrangement specifications 2 10 4 12 6 Figure 2.14 Proccss schcmatic ce Amount 2.80 (a) Transcribe a MATLAB program that generates the matrix A and vector b required to unfold the amount ce this restraintmal of equations (b) Transcribe a MATLAB program that unfolds this order using natural Gauss ejection. What happens? How do you tie it?

    Consider the arrangement stream diagram shown in Fig. 2.14. We can transcribe this quenched as the order of equations m1 = m2 + m3 + m4 + m5 m_2 = m_9 + m_10 + m_11 m_5 = m_8 + m_7+m_6 m_12 = m_4 + m_7 + m_11 m_1 =100 m_5 = 5 ms 0.84 m_12 = m_4 + m_7 0.7 m_1 = m_2 + m_3 0.55 m_1 = m_9 + m_12 0.2 m_9 = m_10 0.85m_2 = m_9 + m_11 3.2 m_6 = m_7 + m_8 The primitive four equations are the magnitude balances: the direct eight equations are the arrangement specifications. (a) Transcribe a MATLAB program that generates the matrix A and vector b required to unfold the amount ce this restraintmal of equations. (b) Transcribe a MATLAB program that unfolds this order using natural Gauss ejection. What happens? How do you tie it?

    Expert Rejoinder

     

    From the dedicated equations A 12×12 matrix is:

    1 -1 -1 -1 -1 0 0 0 0 0 0 0

    0 1 0 0 0 0 0 0 -1 -1 -1 0

    0 0 0 0 1 -1 -1 -1 0 0 0 0

    0 0 0 -1 0 0 -1 0 0 0 -1 1

    1 0 0 0 0 0 0 0 0 0 0 0

    0 0 0 0 1 0 0 -5 0 0 0 0

    0 0 0 -1 0 0 -1 0 0 0 0 0.84

    0.70 -1 -1 0 0 0 0 0 0 0 0 0

    0.55 0 0 0 0 0 0 0 -1 0 0 -1

    0 0 0 0 0 0 0 0 0.20 -1 0 0

    0 0.85 0 0 0 0 0 0 -1 0 -1 0

    0 0 0 0 0 3.20 -1 -1 0 0 0 0

    The b 12×1 matrix is:

    0

    0

    0

    0

    100

    0

    0

    0

    0

    0

    0

    0

    Code:

    %% Unfold direct order of eqution Ax=b using Natural Gaussian Ejection Method

    clc; bright all; cease all;

    A = [1,-1,-1,-1,-1,0,0,0,0,0,0,0;…

    0,1,0,0,0,0,0,0,-1,-1,-1,0;…

    0,0,0,0,1,-1,-1,-1,0,0,0,0;…

    0,0,0,-1,0,0,-1,0,0,0,-1,1;…

    1,0,0,0,0,0,0,0,0,0,0,0;…

    0,0,0,0,1,0,0,-5,0,0,0,0;…

    0,0,0,-1,0,0,-1,0,0,0,0,0.84;…

    0.7,-1,-1,0,0,0,0,0,0,0,0,0;…

    0.55,0,0,0,0,0,0,0,-1,0,0,-1;…

    0,0,0,0,0,0,0,0,0.2,-1,0,0;…

    0,0.85,0,0,0,0,0,0,-1,0,-1,0;…

    0,0,0,0,0,3.2,-1,-1,0,0,0,0];

    b = [0;0;0;0;100;0;0;0;0;0;0;0];

    disp(‘A matix:’)

    disp(A)

    disp(‘b matix:’)

    disp(b)

    [n,~] = bigness(A);

    %Initialize disconnection X

    X = zeros(n,1);

    %%Forward Ejection (convertion Of A to Upeer triangle matrix)

    ce i = 1:n-1

     

    while A(i,i)==0

    temp =A;

    A = [temp(1:(i-1),:);temp(i+1:n,:);temp(i,:)];

    tempb = b;

    b = [tempb(1:(i-1),:);tempb(i+1:n,:);tempb(i,:)];

    end

     

    m = A(i+1:n,i)/A(i,i);

    A(i+1:n,:) = A(i+1:n,:)-m*A(i,:);

    b(i+1:n,:) = b(i+1:n,:)-m*b(i,:);

    end

    %%Back Substitution

    X(n,:) = b(n,:)/A(n,n);

    ce i = n-1:-1:1

    X(i,:) = (b(i,:) – A(i,i+1:n)*X(i+1:n,:))/A(i,i);

    end

    disp(‘Solution:’)

    disp(X)

    Solution:

    100.0000

    40.0000

    30.0000

    9.4565

    20.5435

    4.8913

    11.5435

    4.1087

    30.0000

    6.0000

    4.0000

    25.0000