EAS 230 Homework 4: MATLAB Solutions for Engineering Problems

Verified

Added on  2023/04/24

|5
|1337
|378
Homework Assignment
AI Summary
This document presents MATLAB solutions for EAS 230 Homework 4, a mechanical engineering assignment. The first problem involves balancing a chemical equation using MATLAB to solve a system of linear equations. The second problem focuses on calculating heat exchange by radiation between two black discs, using the Stefan-Boltzmann constant and shape factors, with results computed for varying distances. The final problem requires converting mass, length, and temperature data from Imperial to SI units using MATLAB, including reading data from a text file and writing the converted data to a new file. The solutions include MATLAB code, input, and output for each problem, demonstrating the application of MATLAB in solving various engineering problems related to chemical reactions, heat transfer, and unit conversions. This assignment emphasizes the use of MATLAB for numerical computations and data manipulation in an engineering context.
Document Page
Q.1
The dissolution of copper sulfide in aqueous nitric acid is described by the following
chemical equation:
a Cu S +b NO 3c H + d Cu 2++e SO 42f NO+ g H 2O
Where a, b, c, d, e, f, and g are the numbers of the various molecules participating in the
reaction. They can be determined by balancing each atom on left and right side of the
reaction and then balancing the ionic charge. The resulting equations are:
a=d ,
a=e ,
b=f ,
3 b=4e+ f + g ,
c=2 g ,
b+c=2 d2 e
Which can be rewritten as
ad=0 ,
ae=0 ,
bf =0 ,
3 b4ef g=0 ,
c2 g=0 ,
b+c2 d +2 e=0
As there are 7 unknowns (a, b, c, d, e, f, and g) and only 6 equations. A solution can still be
obtained, however, by taking advantage of the fact that all the coefficients must be positive
integers. A seventh equation can be added by assuming a value of a and solve the system of
equations. For example, your seventh equation can be 𝑎 = 𝑘 where k is a positive integer 1, 2,
3 …etc.
The solution is valid only if all the coefficients (a, b, c, d, e, f, and g) are positive integers. If
this is not the case, repeat the solution using different value for k.
A.1
Equations,
d =0 ,
ae=0 ,
bf =0 ,
3 b4ef g=0 ,
c2 g=0 ,
b+c2 d +2 e=0
a=k
Above system of equation is in the form of Ax=b
On the basis of equation matrix A can be formulated as,
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
A= [ 1 0 0 -1 0 0 0
1 0 0 0 -1 0 0
0 1 0 0 0 -1 0
0 3 0 0 -4 -1 -1
0 0 1 0 0 0 -2
0 -1 1 -2 2 0 0
1 0 0 0 0 0 0]
x=[ a b c d e f g]
b=[ 0 0 0 0 0 0 k]
Here k is any positive integer 1,2,3………etc.
Value of x can be calculated as,
x=A-1.b
MATLAB Code:
k=input('enter a value for k as a positive integer = ');
A= [1 0 0 -1 0 0 0;...
1 0 0 0 -1 0 0;...
0 1 0 0 0 -1 0;...
0 3 0 0 -4 -1 -1;...
0 0 1 0 0 0 -2;...
0 -1 1 -2 2 0 0;...
1 0 0 0 0 0 0;];
b=[0 0 0 0 0 0 k]';
x=A\b;
formatSpec = 'When a = %4.2f, b = %4.2f, c = %4.2f, d = %4.2f, e = %4.2f, f = %4.2f, g =
%4.2f\n';
fprintf(formatSpec,x)
if x(1,1)>0 && x(2,1)>0 && x(3,1)>0 && x(4,1)>0 && x(5,1)>0 && x(6,1)>0 &&...
x(7,1)>0;
else
Go TO 1
end
Output:
enter a value for k as a positive integer = 1
When a = 1.00, b = 2.67, c = 2.67, d = 1.00, e = 1.00, f = 2.67, g = 1.33
enter a value for k as a positive integer = 2
When a = 2.00, b = 5.33, c = 5.33, d = 2.00, e = 2.00, f = 5.33, g = 2.67
Document Page
Q.2
The net heat exchange by radiation from a black disc 1 with radius b to a black disc 2 with
radius a, that are separated by a distance c is given by:
q=σπ b2 F 12(T1
4T 2
4 )
Where 𝑇1 and 𝑇2 are the absolute temperatures of the plates,
𝜎 = 5.669 × 10-8 W/(m2-K4) is the Stefan- Boltzmann constant, and 𝐹1−2 is a shape
factor which, for the arrangement in the figure, is given by:
F 12=1/2 [ Z ( Z24 X2 Y 2 ) ]
Where 𝑋 = 𝑎/𝑐, 𝑌 = 𝑐/𝑏, and 𝑍 = 1 + (1 + 𝑋2)2.
Use your script to calculate the results for 𝑇1 = 600 K, 𝑇2 = 400 K, 𝑎 = 1 m, 𝑏 = 2 m, and 𝑐 =
0.5, 1, 1.5, … , 10 m.
Answer.
It is problem of radiation heat transfer,
MATLAB Code:
format short g
T_1=600;
T_2=400;
a=1;
b=2;
c=0.5:0.5:10;
Document Page
sigma=5.669*10^-8;
X=a./c;
Y=c./b;
Z=1+((1+X.^2).*Y.^2);
F_12=(1/2)*(Z-sqrt(Z.^2-4*X.^2.*Y.^2));
q=(sigma*pi*b^2*F_12.*(T_1^4-T_2^4))';
disc1=[a,T_1];
disc2=[b,T_2];
A=[c',q];
formatSpec1 = 'For circular disc 1 with radius %4.1f m and temperature
%4.1f K\n';
formatSpec2 = 'and circular disc 1 with radius %4.1f m and temperature
%4.1f K\n';
fprintf(formatSpec1,disc1)
fprintf(formatSpec2,disc2)
disp('Radiation Heat Exchange Between 2 Black Circular Discs')
disp('')
disp(' Distance Radiation Heat Exchange')
disp(' (m) (Watts)')
disp(A)
Output:
For circular disc 1 with radius 1.0 m and temperature 600.0 K
and circular disc 1 with radius 2.0 m and temperature 400.0 K
Radiation Heat Exchange Between 2 Black Circular Discs
Distance Radiation Heat Exchange
(m) (Watts)
0.5 17130
1 14150
1.5 11144
2 8684.5
2.5 6808.1
3 5404.7
3.5 4354.3
4 3560.6
4.5 2952.8
5 2480.7
5.5 2108.6
6 1811.4
6.5 1570.8
7 1373.9
7.5 1210.9
8 1074.6
8.5 959.72
9 861.96
9.5 778.17
10 705.86
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Q.3
The text file MLT_Imp.txt has some mass, length, and temperature data given in Imperial Units
and it is required to be converted into SI units. The 1st column of MLT is the mass in lb, the 2nd
column is the length in inches and the 3rd column is the temperature in oF. The conversion factors
are:
1 kg=2.2046 lb
1¿ 0.0254 m
1 F=1C ×( 9
5 )+32
Input file:MLT.txt
2 10 -30
4 20 -20
6 30 -10
8 40 0
10 50 10
12 60 20
14 70 30
16 80 40
18 90 50
20 100 60
A.3
MATLAB code:
A=dlmread('MLT.txt');
lb=A(:,1);
in=A(:,2);
F=A(:,3);
kg=2.2046*lb;
m=in/0.0254;
C=(F-32)/(9/5);
B=[kg,m,C]';
fileID = fopen('UBitName_MLT_SI.txt','w');
fprintf(fileID,'%4.3f\t %4.3f\t %4.3f\t\n',B);
fclose(fileID);
Output:
chevron_up_icon
1 out of 5
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]