Sunteți pe pagina 1din 30

Laboratory Exercise No.

5
Steady-state Material Balances on a Separation Train
1. Objective:
The activity aims to solve a chemical engineering problem dealing with steady-state material balances
on a separation train using matlab.
2. Intended Learning Outcomes (ILOs):
The students shall be able to:
2.1 solve problem involving steady-state material balances on a separation train.
3. Discussion :
A mass balance, also called a material balance, is an application of conservation of mass to the analysis
of physical systems. By accounting for material entering and leaving a system, mass flows can be
identified which might have been unknown, or difficult to measure without this technique. The exact law
used in the analysis of the system depends on the context of the problem, but all revolve around mass
conservation, i.e. that matter cannot disappear or be created spontaneously.
Therefore, mass balances are used widely in engineering and environmental analyses. For example,
mass balance theory is used to design chemical reactors, to analyze alternative processes to produce
chemicals, as well as to model pollution dispersion and other processes of physical systems. Closely
related and complementary analysis techniques include the population balance, energy balance and the
somewhat more complex entropy balance. These techniques are required for thorough design and
analysis of systems such as the refrigeration cycle.
4. Resources:
MATLAB
5. Procedure:
1. For the four equations four unknowns as shown below :
2w + 5x - 3y - 4z = 9
-3w - 2x +4y - 5z = 23
2w + 5x + 3y - 6z = 39
w + 5x + 4y - 2z = 29
a. Obtain the four by four matrix of the LHS of the system of equations and assign it to variable A.
Run it in the matlab command window. Use Table 1 for the matlab commands and output of
these commands.
b. Obtain the one by four matrix of the RHS of the system of equations and assign it to variable
B. Run it in the matlab command window. Use Table 1 for the matlab commands and output of
these commands.
c. Using the command A\B and assign to it to variable w, x, y and z values. Run it in the matlab
command window. Use Table 1 for the matlab commands and output of these commands..
d. Create an m-file for the solution of the system of equations. Run it and show the results. Also,
show the contents of m-file.
e. Create an m-file using disp( ), input( ), and fprintf( ) commands. Run it and show the results.
Also, show the contents of m-file.
2. Provide a unique system of equations, ten equations in ten unknowns ( having coefficients and
values of the unknowns which are all whole numbers) and answer the following:
a. Obtain the ten by ten matrix of the LHS of the system of equations and assign it to variable A.
Run it in the matlab command window. Use Table 2 for the matlab commands and output of
these commands.
b. Obtain the one by ten matrix of the RHS of the system of equations and assign it to variable B.
Run it in the maltlab command window. Use Table 2 for the matlab commands and output of
these commands.
c. Using the command A\B and assign it to ten distinct variables. Run it in matlab command
window. Use Table 2 for the matlab commands and output of these commands.
d. Create an m-file for the solution of the system of equations. Run it and show the results. Also,
show the contents of m-file.
e. Create an m-file using disp( ), input( ), and fprintf( ) commands. Run it and show the results.
Also, show the contents of m-file.
3. In this problem, we are separating paraxylene, styrene, toluene and benzene via continuous
distillation in three columns. Continuous distillation is typically a steady-state process as the
lighter components (lower boiling temperatures at the operating pressure) will collect overhead
and the heavier will collect in the bottoms. Depending on what your purity specifications are will
then determine how you want to operate your equipment. A schematic with the problem details is
shown below:
a. Using 1 minute of operation, obtain the system of equations, four equations in four unknowns,
involving material balances of xylene, styrene, toluene, and benzene. Show the system of
equations in Table 3.
b. Obtain the four by four matrix of the resulting system of equations in 3a and assign it to variable A.
Run it in the matlab command window. Use Table 3 for the matlab commands and output of these
commands.
c. Obtain the one by four matrix of the resulting system of equations in 3a and assign it to variable B.
Run it in the matlab command window. Use Table 3 for the matlab commands and output of these
commands.
d. Using the command A\B, assign it to four distinct variables representing the molar flow rates of
D_1, B_1, D_2, and B_2. Run it in the matlab command window. Use Table 3 for the matlab
commands and output of these commands..
e. Create an m-file for the solution of system of equations in 3a. Run it and show the results. Also,
show the contents of m-file.
f. Create an m-file using disp( ), input( ) and fprintf( ) matlab commands. Run it and show the results.
Also, show the contents of m-file.
4. For the illustration as shown below,
a. Using Column #2, provide for the matlab command that will determine the flowrate of stream D.
Run it in the matlab command window. Use Table 4 for the matlab commands and output of
these commands.
b. Provide for matlab commands that will determine the mole fraction of xylene, styrene, toluene,
and benzene in stream D. Run them in the command window. Use Table 3 for the matlab
commands and output of these commands.
c. Create an m-file that will provide solutions in 4a and 4b. Run it and show the results. Also,
show the contents of m-file.
d. Create an m-file using disp( ), input( ) and fprint( ) matlab commands that will provide solutions
in 4a and 4b. Run it and show the results. Also, show the contents of m-file.

5. Using Figure1,

e. Using Column #3, provide for the matlab command that will determine the flowrate of stream B.
Run it in the matlab command window. Use Table 5 for the matlab commands and output of
these commands.
f. Provide matlab commands that will determine the mole fraction of xylene, styrene, toluene, and
benzene in stream B. Run them in the command window. Use Table 5 for the matlab
commands and output of these commands.
a. Create an m-file that will provide solutions in 5a and 5b. Run it and show the results. Also,
show the contents of m-file.
b. Create an m-file using disp( ), input( ), and fprint( ) matlab commands that will provide solutions
in 5a and 5b. Run it and show the results. Also, show the contents of m-file.
Course: Laboratory Exercise No.: 5
Group No.: Section: CH52FC1
Group Members: Date Performed: July 26, 2017
Cuesta, Alwyn Wren C. Date Submitted: August 2, 2017
Instructor: Engr. Crispulo Maranan

6. Data and Results:


1. Procedure 1
Table 1. Four equations in Four Unknowns

1a >> A=[2 5 -3 -4; -3 -2 4 -5; 2 5 3 -6; 1 5 4 -2]

A=

2 5 -3 -4
-3 -2 4 -5
2 5 3 -6
1 5 4 -2
1b >> B=[9; 23; 39; 29]

B=

9
23
39
29
1c >> A\B

ans =

2.0000
1.0000
4.0000
-3.0000

>> C=ans

C=

2.0000
1.0000
4.0000
-3.0000
>> W=C(1,:)

W=

2.0000

>> W=C(2,:)

W=

1.0000

>> W=C(3,:)

W=

>> W=C(4,:)

W=

-3.0000
1d On script window: <Cuesta_Solution.m>
disp('Solution for the System of Equations:');
eq1=('2*w + 5*x - 3*y - 4*z = 9');

eq2=('-3*w - 2*x + 4*y - 5*y = 23');

eq3=('2*w + 5*x + 3*y - 6*z = 39');

eq4=('w + 5*x + 4*y - 2*z = 29');

[w,x,y,z]=solve(eq1,eq2,eq3,eq4, 'w,x,y,z')

On command window:

>> Cuesta_Solution
Solution for the System of Equations:

w=

-1919/178

x=
563/178

y=

537/178

z=

-1059/178
1e On script window: <Cuesta_Solution2.m>
A=input('Enter the 4x4 matrix from the equation: ');
B=input('Enter the 1x4 matrix from the equation: ');

solve=A\B;

w=solve(1,:);

x=solve(2,:);

y=solve(3,:);

z=solve(4,:);

fprintf('\n W is %0.3f.',w);

fprintf('\n X is %0.3f.',x);

fprintf('\n Y is %0.3f.',y);

fprintf('\n Z is %0.3f.',z);

On command window:
>> Cuesta_Solution2
Enter the 4x4 matrix from the equation: [2 5 -3 -4; -3 -2 4 -5; 2 5 3 -6; 1 5 4 -2];
Enter the 1x4 matrix from the equation: [9; 23; 39; 29];

W is 2.000.
X is 1.000.
Y is 4.000.
Z is -3.000.>>

2. Procedure 2
Table 2. Ten equations in Ten Unknowns

2a >> A=[1 23 56 6 7 1 2 2 2 7; 12 65 23 78 37 568 86 98 90 1; 12 34 45 56 67 78 89 51 16


27; 26 34 76 38 6 1 6 2 5 67; 12 6 23 4 2 1 23 788 12 7; 12 87 5 1 6 9 1 2 5 7; 25 1 2 3 4
1 3 45 6 23; 12 345 3 5 67 8 9 12 34 3; 4 34 6 7 45 36 76 87 9 8; 65 23 56 8 5 4 56 87 9
12]

A=

1 23 56 6 7 1 2 2 2 7
12 65 23 78 37 568 86 98 90 1
12 34 45 56 67 78 89 51 16 27
26 34 76 38 6 1 6 2 5 67
12 6 23 4 2 1 23 788 12 7
12 87 5 1 6 9 1 2 5 7
25 1 2 3 4 1 3 45 6 23
12 345 3 5 67 8 9 12 34 3
4 34 6 7 45 36 76 87 9 8
65 23 56 8 5 4 56 87 9 12
2b >> B=[59; 1; 7; 45; 12; 234; 76; 123; 87; 61]

B=

59
1
7
45
12
234
76
123
87
61
2c >> A\B

ans =

9.9432
2.1922
0.7065
-8.6360
12.9218
8.1916
-6.6738
0.7151
-47.0346
2.6041

>> C=ans
C=

9.9432
2.1922
0.7065
-8.6360
12.9218
8.1916
-6.6738
0.7151
-47.0346
2.6041

>> a=C(1,:)

a=

9.9432

>> b=C(2,:)

b=

2.1922

>> c=C(3,:)

c=

0.7065

>> d=C(4,:)

d=

-8.6360

>> e=C(5,:)

e=

12.9218

>> f=C(6,:)

f=
8.1916

>> g=C(7,:)

g=

-6.6738

>> h=C(8,:)

h=

0.7151

>> i=C(9,:)

i=

-47.0346

>> j=C(10,:)

j=

2.6041
2d On script window: <Cuesta_Solution3part1.m>
disp('Solution for the System of Equations:');
eq1=('a + 23b + 56c + 6d + 7e + 1f + 2g + 2h + 2i + 7j = 59');

eq2=('12a + 65b + 23c + 78d + 37e + 568f + 86g + 98h + 90i + j = 1');

eq3=('12a + 34b + 45c + 56d + 67e + 78f + 89g + 51h + 16i + 27j = 7');

eq4=('26a + 34b + 76c + 38d + 6e + f + 6g + 2h + 5i + 67j = 45');

eq5=('12a + 6b + 23c + 4d + 2e + f + 23g + 788h + 12i + 7j = 12');

eq6=('12a + 87b + 5c + d + 6e + 9f + 1g + 2h + 5i + 7j = 234');

eq7=('25a + b + 2c + 3d + 4e + 1f + 3g + 45h + 6i + 23j = 76');

eq8=('12a + 345b + 3c + 5d + 67e + 8f + 9g + 12h + 34i + 3j = 123');

eq9=('4a + 34b + 6c + 7d + 45e + 36f + 76g + 87h + 9i + 8j = 87');

eq10=('65a + 23b + 56c + 8d + 5e + 4f + 56g + 87h + 9i + 12j = 61');


[a,b,c,d,e,f,g,h,i,j]=solve(eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10, 'a,b,c,d,e,f,g,h,i,j');

On command window:
>> Cuesta_Solution3part1
Solution for the System of Equations:

a=

9.943

b=

2.192

c=

0.707

d=

-8.636

e=

12.922

f=

8.192

g=

-6.674

h=

0.715

i=

-47.035

j=
2.604
2e On script window: <Cuesta_Solution3part2.m>
A=input('Enter the 10x10 matrix from the equation: ');
B=input('Enter the 1x10 matrix from the equation: ');

solve=A\B;

a=solve(1,:);

b=solve(2,:);

c=solve(3,:);

d=solve(4,:);

e=solve(5,:);

f=solve(6,:);

g=solve(7,:);

h=solve(8,:);

i=solve(9,:);

j=solve(10,:);

fprintf('\n A is %0.3f.',a);

fprintf('\n B is %0.3f.',b);

fprintf('\n C is %0.3f.',c);

fprintf('\n D is %0.3f.',d);

fprintf('\n E is %0.3f.',e);

fprintf('\n F is %0.3f.',f);

fprintf('\n G is %0.3f.',g);

fprintf('\n H is %0.3f.',h);

fprintf('\n I is %0.3f.',i);

fprintf('\n J is %0.3f.',j);

On command window:
>> Cuesta_Solution3part2
Enter the 10x10 matrix from the equation: [1 23 56 6 7 1 2 2 2 7; 12 65 23 78 37 568 86
98 90 1; 12 34 45 56 67 78 89 51 16 27; 26 34 76 38 6 1 6 2 5 67; 12 6 23 4 2 1 23 788
12 7; 12 87 5 1 6 9 1 2 5 7; 25 1 2 3 4 1 3 45 6 23; 12 345 3 5 67 8 9 12 34 3; 4 34 6 7 45
36 76 87 9 8; 65 23 56 8 5 4 56 87 9 12];
Enter the 1x10 matrix from the equation: [59; 1; 7; 45; 12; 234; 76; 123; 87; 61];

A is 9.943.
B is 2.192.
C is 0.707.
D is -8.636.
E is 12.922.
F is 8.192.
G is -6.674.
H is 0.715.
I is -47.035.
J is 2.604.>>

3. Procedure 3
Table 3. System of Equations Involving Material Balance

3a 0.07*D1 + 0.18*B1 + 0.15*D2 + 0.24*B2 = 10.5


0.04*D1 + 0.24*B1 + 0.10*D2 + 0.65*B2 = 17.5
0.54*D1 + 0.42*B1 + 0.54*D2 + 0.10*B2 = 28.0
0.35*D1 + 0.16*B1 + 0.21*D2 + 0.01*B2 = 14.0
3b >> A=[0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54 0.42 0.54 0.10; 0.35 0.16 0.21 0.01]

A=

0.0700 0.1800 0.1500 0.2400


0.0400 0.2400 0.1000 0.6500
0.5400 0.4200 0.5400 0.1000
0.3500 0.1600 0.2100 0.0100
3c >> B=[10.5; 17.5; 28.0; 14.0]

B=

10.5000
17.5000
28.0000
14.0000
3d >> A\B

ans =

26.2500
17.5000
8.7500
17.5000

>> C=ans

C=

26.2500
17.5000
8.7500
17.5000

>> D1=C(1,:)

D1 =

26.2500

>> b=C(2,:)

B1 =

17.5000

>> c=C(3,:)

D2 =

8.7500

>> B2=C(4,:)

B2 =

17.5000
3e On script window: <Cuesta_Solution4part1.m>
disp('Solution for the System of Equations:');
eq1=('0.07*a + 0.18*b + 0.15*c + 0.24*d = 10.5');

eq2=('0.04*a + 0.24*b + 0.10*c + 0.65*d = 17.5');

eq3=('0.54*a + 0.42*b + 0.54*c + 0.10*d = 28.0');

eq4=('0.35*a + 0.16*b + 0.21*c + 0.01*d = 14.0');

[a,b,c,d]=solve(eq1,eq2,eq3,eq4, 'a,b,c,d')
On command window:
>> Cuesta_Solution4part1
Solution for the System of Equations:

a=

26.25

b=

17.5

c=

8.75

d=

17.5
3f On script window: <Cuesta_Solution4part2.m>
A=input('Enter the 4x4 matrix from the equation: ');
B=input('Enter the 1x4 matrix from the equation: ');

solve=A\B;

D1=solve(1,:);

B1=solve(2,:);

D2=solve(3,:);

B2=solve(4,:);

fprintf('\n D1 is %0.3f.',a);

fprintf('\n B1 is %0.3f.',b);

fprintf('\n D2 is %0.3f.',c);

fprintf('\n B2 is %0.3f.',d);

On command window:
>> Cuesta_Solution4part2
Enter the 4x4 matrix from the equation: [0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54
0.42 0.54 0.10; 0.35 0.16 0.21 0.01]
Enter the 1x4 matrix from the equation: [10.5; 17.5; 28.0; 14.0]

D1 is 26.250.
B1 is 17.500.
D2 is 8.750.
B2 is 17.500.>>

4. Procedure 4
Table 4. Material Balance Involving Column #2

4a >> A=[0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54 0.42 0.54 0.10; 0.35 0.16 0.21 0.01]

A=

0.0700 0.1800 0.1500 0.2400


0.0400 0.2400 0.1000 0.6500
0.5400 0.4200 0.5400 0.1000
0.3500 0.1600 0.2100 0.0100

>> B=[10.5; 17.5; 28.0; 14.0]

B=

10.5000
17.5000
28.0000
14.0000

>> A\B

ans =

26.2500
17.5000
8.7500
17.5000

>> C=ans

C=

26.2500
17.5000
8.7500
17.5000
>> D1=C(1,:)

D1 =

26.2500

>> B1=C(2,:)

B1 =

17.5000

>> D=D1+B1

D=

43.7500
4b >> A=[0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54 0.42 0.54 0.10; 0.35 0.16 0.21 0.01]

A=

0.0700 0.1800 0.1500 0.2400


0.0400 0.2400 0.1000 0.6500
0.5400 0.4200 0.5400 0.1000
0.3500 0.1600 0.2100 0.0100

>> B=[10.5; 17.5; 28.0; 14.0]

B=

10.5000
17.5000
28.0000
14.0000

>> A\B

ans =

26.2500
17.5000
8.7500
17.5000

>> C=ans
C=

26.2500
17.5000
8.7500
17.5000

>> D1=C(1,:)

D1 =

26.2500

>> B1=C(2,:)

B1 =

17.5000

>> D2=C(3,:)

D2=

17.5000

>> B2=C(4,:)

B2 =

17.5000

>>nX=(0.07*D1+0.18*B1)/(D1+B1)

nX =

0.1140

>>nS=(0.04*D1+0.24*B1)/(D1+B1)

nS =

0.1200

>>nT=(0.54*D1+0.42*B1)/(D1+B1)

nT =
0.4920

>>nB=(0.35*D1+0.16*B1)/(D1+B1)

nB =

0.2740
4c-a On script window: <Cuesta_Solution5part1.m>
disp('Solution for the System of Equations:');
eq1=('0.07*D1 + 0.18*B1 + 0.15*D2 + 0.24*B2 = 10.5');
eq2=('0.04*D1 + 0.24*B1 + 0.10*D2 + 0.65*B2 = 17.5');
eq3=('0.54*D1 + 0.42*B1 + 0.54*D2 + 0.10*B2 = 28.0');
eq4=('0.35*D1 + 0.16*B1 + 0.21*D2 + 0.01*B2 = 14.0');
[D1,B1,D2,B2]=solve(eq1,eq2,eq3,eq4, 'D1,B1,D2,B2')
D=D1+B1
On command window:
>> Cuesta_Solution5part1

Solution for the System of Equations:

D1 =

26.25

B1 =

17.5

D2 =

8.75

B2 =

17.5

D=

43.75
4c-b On script window: <Cuesta_Solution5part2.m>
disp('Solution for the System of Equations:');
eq1=('0.07*D1 + 0.18*B1 + 0.15*D2 + 0.24*B2 = 10.5');
eq2=('0.04*D1 + 0.24*B1 + 0.10*D2 + 0.65*B2 = 17.5');
eq3=('0.54*D1 + 0.42*B1 + 0.54*D2 + 0.10*B2 = 28.0');
eq4=('0.35*D1 + 0.16*B1 + 0.21*D2 + 0.01*B2 = 14.0');
[D1,B1,D2,B2]=solve(eq1,eq2,eq3,eq4, 'D1,B1,D2,B2')
D=D1+B1
nX=(0.07*D1+0.18*B1)/(D1+B1)
nS=(0.04*D1+0.24*B1)/(D1+B1)
nT=(0.54*D1+0.42*B1)/(D1+B1)
nB=(0.35*D1+0.16*B1)/(D1+B1)

On command window:
>> Cuesta_Solution5part2

Solution for the System of Equations:

D1 =

26.25

B1 =

17.5

D2 =

8.75

B2 =

17.5

D=

43.75

nX =
0.114

nS =

0.12

nT =

0.492

nB =

0.274
4d-a On script window: <Cuesta_Solution6part1.m>
A=input('Enter the 4x4 matrix from the equation: ');
B=input('Enter the 1x4 matrix from the equation: ');
solve=A\B;
D1=solve(1,:);
B1=solve(2,:);
D2=solve(3,:);
B2=solve(4,:);
D=D1+B1;
fprintf('\n D1 is %0.3f.',D1);
fprintf('\n B1 is %0.3f.',B2);
fprintf('\n D2 is %0.3f.',D2);
fprintf('\n B2 is %0.3f.',B2);
fprintf('\n D is %0.3f.',D);
On command window:
>> Cuesta_Solution6part1
Enter the 4x4 matrix from the equation: [0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54
0.42 0.54 0.10; 0.35 0.16 0.21 0.01];
Enter the 1x4 matrix from the equation: [10.5; 17.5; 28; 14];
D1 is 26.250.
B1 is 17.500.
D2 is 8.750.
B2 is 17.500.
D is 43.750.
4d-b On script window: <Cuesta_Solution6part2.m>
A=input('Enter the 4x4 matrix from the equation: ');
B=input('Enter the 1x4 matrix from the equation: ');
solve=A\B;
D1=solve(1,:);
B1=solve(2,:);
D2=solve(3,:);
B2=solve(4,:);
D=D1+B1;
nX=(0.07*D1+0.18*B1)/(D1+B1);
nS=(0.04*D1+0.24*B1)/(D1+B1);
nT=(0.54*D1+0.42*B1)/(D1+B1);
nB=(0.35*D1+0.16*B1)/(D1+B1);
fprintf('\n D1 is %0.3f.',D1);
fprintf('\n B1 is %0.3f.',B2);
fprintf('\n D2 is %0.3f.',D2);
fprintf('\n B2 is %0.3f.',B2);
fprintf('\n nX is %0.3f.',nX);
fprintf('\n nS is %0.3f.',nS);
fprintf('\n nT is %0.3f.',nT);
fprintf('\n nB is %0.3f.',nB);
On command window:
>> Cuesta_Solution6part2
Enter the 4x4 matrix from the equation: [0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54
0.42 0.54 0.10; 0.35 0.16 0.21 0.01];
Enter the 1x4 matrix from the equation: [10.5; 17.5; 28; 14];

D1 is 26.250.
B1 is 17.500.
D2 is 8.750.
B2 is 17.500.
nX is 0.114.
nS is 0.120.
nT is 0.492.
nB is 0.274.>>
5. Procedure 5
Table 5. Material Balance Involving Column #3

5a >> A=[0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54 0.42 0.54 0.10; 0.35 0.16 0.21 0.01]

A=

0.0700 0.1800 0.1500 0.2400


0.0400 0.2400 0.1000 0.6500
0.5400 0.4200 0.5400 0.1000
0.3500 0.1600 0.2100 0.0100

>> B=[10.5; 17.5; 28.0; 14.0]

B=

10.5000
17.5000
28.0000
14.0000

>> A\B

ans =

26.2500
17.5000
8.7500
17.5000

>> C=ans

C=

26.2500
17.5000
8.7500
17.5000

>> D2=C(3,:)

D2 =

8.7500
>> B2=C(4,:)

B2 =

17.5000

>> B=D2+B2

B=

26.2500
5b >> A=[0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54 0.42 0.54 0.10; 0.35 0.16 0.21 0.01]

A=

0.0700 0.1800 0.1500 0.2400


0.0400 0.2400 0.1000 0.6500
0.5400 0.4200 0.5400 0.1000
0.3500 0.1600 0.2100 0.0100

>> B=[10.5; 17.5; 28.0; 14.0]

B=

10.5000
17.5000
28.0000
14.0000

>> A\B

ans =

26.2500
17.5000
8.7500
17.5000

>> C=ans

C=

26.2500
17.5000
8.7500
17.5000

>> D1=C(1,:)

D1 =

26.2500

>> B1=C(2,:)

B1 =

17.5000

>> D2=C(3,:)

D2=

17.5000

>> B2=C(4,:)

B2 =

17.5000

>>nX=(0.15*D1+0.24*B1)/(D1+B1)

nX =

0.1860

>>nS=(0.10*D1+0.65*B1)/(D1+B1)

nS =

0.3200

>>nT=(0.54*D1+0.10*B1)/(D1+B1)

nT =

0.3640

>>nB=(0.21*D1+0.01*B1)/(D1+B1)
nB =

0.1300
5c-a On script window: <Cuesta_Solution7part1.m>
disp('Solution for the System of Equations:');
eq1=('0.07*D1 + 0.18*B1 + 0.15*D2 + 0.24*B2 = 10.5');
eq2=('0.04*D1 + 0.24*B1 + 0.10*D2 + 0.65*B2 = 17.5');
eq3=('0.54*D1 + 0.42*B1 + 0.54*D2 + 0.10*B2 = 28.0');
eq4=('0.35*D1 + 0.16*B1 + 0.21*D2 + 0.01*B2 = 14.0');
[D1,B1,D2,B2]=solve(eq1,eq2,eq3,eq4, 'D1,B1,D2,B2')
B=D2+B2
On command window:
>> Cuesta_Solution7part1

Solution for the System of Equations:

D1 =

26.25

B1 =

17.5

D2 =

8.75

B2 =

17.5

B=

26.25
5c-b On script window: <Cuesta_Solution7part2.m>
disp('Solution for the System of Equations:');
eq1=('0.07*D1 + 0.18*B1 + 0.15*D2 + 0.24*B2 = 10.5');
eq2=('0.04*D1 + 0.24*B1 + 0.10*D2 + 0.65*B2 = 17.5');
eq3=('0.54*D1 + 0.42*B1 + 0.54*D2 + 0.10*B2 = 28.0');
eq4=('0.35*D1 + 0.16*B1 + 0.21*D2 + 0.01*B2 = 14.0');
[D1,B1,D2,B2]=solve(eq1,eq2,eq3,eq4, 'D1,B1,D2,B2')
B=D2+B2
nX=(0.15*D2+0.24*B2)/(D2+B2)
nS=(0.10*D2+0.65*B2)/(D2+B2)
nT=(0.54*D2+0.10*B2)/(D2+B2)
nB=(0.21*D2+0.01*B2)/(D2+B2)

On command window:
>> Cuesta_Solution7part2

Solution for the System of Equations:

D1 =

26.25

B1 =

17.5

D2 =

8.75

B2 =

17.5

D=

43.75

nX =

0.21

nS =
0.46666666666666666666666666666667

nT =

0.24666666666666666666666666666667

nB =

0.076666666666666666666666666666667
5d-a On script window: <Cuesta_Solution8part1.m>
A=input('Enter the 4x4 matrix from the equation: ');
B=input('Enter the 1x4 matrix from the equation: ');
solve=A\B;
D1=solve(1,:);
B1=solve(2,:);
D2=solve(3,:);
B2=solve(4,:);
B=D2+B2;
fprintf('\n D1 is %0.3f.',D1);
fprintf('\n B1 is %0.3f.',B2);
fprintf('\n D2 is %0.3f.',D2);
fprintf('\n B2 is %0.3f.',B2);
fprintf('\n B is %0.3f.',B);
On command window:
>> Cuesta_Solution8part1
Enter the 4x4 matrix from the equation: [0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54
0.42 0.54 0.10; 0.35 0.16 0.21 0.01];
Enter the 1x4 matrix from the equation: [10.5; 17.5; 28; 14];
D1 is 26.250.
B1 is 17.500.
D2 is 8.750.
B2 is 17.500.
B is 26.250. >>
5d-b On script window: <Cuesta_Solution6part2.m>
A=input('Enter the 4x4 matrix from the equation: ');
B=input('Enter the 1x4 matrix from the equation: ');
solve=A\B;
D1=solve(1,:);
B1=solve(2,:);
D2=solve(3,:);
B2=solve(4,:);
B=D2+B2;
nX=(0.15*D2+0.24*B2)/(D2+B2)
nS=(0.10*D2+0.65*B2)/(D2+B2)
nT=(0.54*D2+0.10*B2)/(D2+B2)
nB=(0.21*D2+0.01*B2)/(D2+B2)
fprintf('\n D1 is %0.3f.',D1);
fprintf('\n B1 is %0.3f.',B2);
fprintf('\n D2 is %0.3f.',D2);
fprintf('\n B2 is %0.3f.',B2);
fprintf('\n nX is %0.3f.',nX);
fprintf('\n nS is %0.3f.',nS);
fprintf('\n nT is %0.3f.',nT);
fprintf('\n nB is %0.3f.',nB);
On command window:
>> Cuesta_Solution6part2
Enter the 4x4 matrix from the equation: [0.07 0.18 0.15 0.24; 0.04 0.24 0.10 0.65; 0.54
0.42 0.54 0.10; 0.35 0.16 0.21 0.01];
Enter the 1x4 matrix from the equation: [10.5; 17.5; 28; 14];

D1 is 26.250.
B1 is 17.500.
D2 is 8.750.
B2 is 17.500.
nX is 0.21.
nS is 0.46666666666666666666666666666667.
nT is 0.24666666666666666666666666666667.
nB is 0.076666666666666666666666666666667.>>

7. Conclusion:
I therefore conclude that MATLAB is so versatile that it cannot just solid mensuration problems and loop-
involving problems, as we did previously, but also Material Balances! By making use of the script window
and making an m file, you just have to write the matrix form of the equations and you can either make a
solver of it or a solver where an input is required. This laboratory exercise made me further understands the
functions of MATLAB and its features. Thanks to this laboratory experiment, I could now solve material
balances, no matter how complicated using MATLAB by just typing codes.
8. Assessment (Rubric for Laboratory Performance):

S-ar putea să vă placă și