辅导案例-ESG 302

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top
ESG 302: Computational Project

The Cp,m for many materials can be expressed by the polynomial:

, = + +
−2 + ⋯
Where T is the temperature in K.

(1) Write a code in Matlab to compute the thermodynamic functions molar Enthalpy (H)
and Entropy (S), with an option for user to input:
• the temperature range,
• the number of intervals (n) to compute the area under the curve using the Simpson’s
1/3 rule, and
• the coefficients A, B, C and D in the equation approximation of Cp,m.

(2) Using the code developed in the previous task compute molar H and S for AlN. Based
on experimental observations (Koshchenko et al. (1984)), the Cp,m of AlN (300can be written as:

, = 45.94 + 3.347 × 10
−3 − 14.98 × 105 −2 (J −1K)

Calculate the Enthalpy (H) and Entropy (S) for the above material using the following
values:

T1= 500 K T2 = 1000K n = 500.

You are required to submit a report with the following sections:
Section 1: Code of your working program. (submit Matlab files)
• Details of the compiler used
Section 2: Results for Enthalpy and Entropy values for AlN using the conditions
specified above.
• Screenshot of window prompting and accepting user Input
• Screen shot of computed values

Notes:

1. Your code should contain appropriate comments explaining the logic/requirement of
commands being executed.
2. Answer must be estimated using the Simpson’s Rule, any other/better way or pre-
existing curve integration functions (including ‘Simpson’ function) in the program will
NOT get any credits.

















BACKGROUND INFORMATION

What is integration?

Integration is the process of measuring the area under a function plotted on a graph.
Why would we want to integrate a function? Among the most common examples are finding
the velocity of a body from an acceleration function, and displacement of a body from a velocity
function.


If we want to find out the integral value of f(x) between limits a and b, the darkened portion of
the graph gives us the solution. It is basically finding the area under curve f(x) between the
limits a and b. Evaluation of the expression f(x) may be difficult sometimes and to simplify the
integral, a wide variety of numerical integration methods have been developed. We will be
discussing Simpson’s 1/3 rule of integration which gives a more accurate value when compared
with other numerical integration methods.

Simpson’s Rule 1/3 rule:

In Simpson's Rule, we use parabolas to approximate each part of the curve. This proves to
be very efficient.



We can show (by integrating the area under each parabola and adding these areas) that the
approximate area is given by Simpson's Rule:
Δx = (b – a) / n

In Simpson’s rule, n must be even.

Example:

Let us take a simple example. Let us find out the integral of f(x) = x2 between limits 2 and 3 and
number of division n = 4 using simpson’s rule.
f(x) = x2
b = 3 , a = 2
Δx = (b – a) / n = (3 – 2) / 4 = 0.25

y0 = f(a) = f(2) = 22 = 4
y1 = f(a + Δx) = f(2 + 0.25) = f(2.25) = 2.252 = 5.0625
y2 = f(a + 2Δx) = f(2 + (2 * 0.25)) = f(2+ 0.5) = f(2.5) = 2.52 = 6.25
y3 = f(a + 3Δx) = f(2 + (3 * 0.25)) = f(2+ 0.75) = f(2.75) = 2.752 = 7.5625
y4 = f(b) = f(3) = 32 = 9

Therefore,

= 0.25 / 3 (4 + (4* 5.0625) + (2*6.25) + (4*7.5625) + 9)
= 0.25 / 3 (4 + 20.25 + 12.5 + 30.25 + 9)
= 6.33333


Therefore the area under the function x2 between limits 2 and 3 is 6.33333


Sometimes when the number of intervals required is higher (of order 1000), a computer
program to calculate the final answer would be easier. Let’s try:

















MATLAB:

Let us write a MATLAB program to find out the integral value of x2 between limits 2 and 3 and
number of divisions n = 4 using Simpson’s 1/3 rule.

answer = inputdlg('Enter Lower limit, Upper limit and Numbers of
interval separated by space:',...
'Input', [1 50]); % Ask user to input the parameters
uln=str2num(answer{1}); % Convert input to numerical values
l=uln(1); % Assign the first number input to variable l
u=uln(2); % Assign the second number input to variable u
n=uln(3); % Assign the third number input to variable n
t=(u-l)/n; % Delta x
x=[l:t:u]; % Generate the matrix of x
y=x.^2; % The matrix for the results of equation y=x^2
a=ones(1,n/2)*4; % Generate the matrix for the parameter 4
b=ones(1,(n/2-1))*2; % Generate the matrix for the parameter 2
c=zeros(1,(n+1)); % Generate the matrix to store all parameters
c(:,1)=1; % The first parameter is 1
c(:,end)=1; % The final parameter is 1
c(:,2:2:n)=a; % put all of the parameters of 4 in matrix
c(:,3:2:(n-1))=b; % Put all of the parameters of 2 in matrix
s=y.*c; % The matrix for (y0,4y1,2y2,4y3,......)
m=sum(s); % The results of y0+4y1+2y2+4y3......
area=t.*m/3

When you run and debug the program on MATLAB the output looks something like this:








Application to thermodynamics:

Example:

The compound 1,3,5-trichloro-2,4,6-trifluorobenzene is an intermediate in the conversion of
hexachlorobenzene to hexafluorobenzene, and its thermodynamic properties have been
examined by measuring its heat capacity over a wide temperature range (R.L. Andon and J.F.
Martin, J. Chem. Soc. Faraday Trans. I. 871 (1973)). Some of the data are as follows:

Calculate the molar enthalpy relative to its value at T = 0 and the Third-Law molar entropy of
the compound at these temperatures.

Solution

51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468