ENCH 407- Assignment # 2
Assignment due date: November 18, 2016, 5pm.
Assignments can be done in groups of at most 3 people. All the group members will receive the same mark. Greatest benefit: do all questions separately, then combine. The purpose is to learn from each other’s mistakes.
Group submissions must show all names, one hand-in per group, no separate hand-ins. You are required to submit Matlab codes via Dropbox folder setup under Assignment #2 folder in D2L. Late homework penalty is 20%/day. Show all your work to receive full mark for each problem.
Problem 1. (35 points) The steady state nutrient concentration, N and the steady state biomass concentration, B, can be described by the following equations:
𝑑𝑁=0=𝑁𝐹−𝑁𝐹−1𝜇 𝑁𝐵 𝑑𝑡 &’ 𝑉 𝑉 𝑌- /01 𝐾 + 𝑁
𝑑𝐵=0=−𝐵𝐹+ 𝜇 𝑁 𝐵 𝑑𝑡 𝑉 /01 𝐾 + 𝑁
Let 56 =𝑓9 𝑁,𝐵 =0 and 5- =𝑓; 𝑁,𝐵 =0. Solve this coupled set of nonlinear 57 57
equations for 𝒙 = (𝑁, 𝐵) using multivariable Newton Raphson method.
a) (5 points) Construct the Jacobian matrix, J in terms of the variables used in the
equations.
b) (2 points) Simplify the Jacobian by substituting in the known constants: Nin = 100 g/m3
F = 5000 m3 /day
V = 1600 m3
YB = 0.80 conversion efficiency μmax = 5 g/m3
K = 20 g/m3
c) (13 points) Let your initial guess be x (0) = (40g/m3, 20g/m3 ). Calculate 2 iterations of the multivariate Newton-Raphson method, to show x (1) and x (2). Take a full Newton step at every iteration. (Feel free to code up Jacobian matrix
and the function f1 and f2 in Matlab to avoid manual calculation errors. Calculate and show the convergence tolerance, using the 2-norm for each iteration.
d) (15 points) Write a Matlab program that solves this system using Newton Raphson method. Does the problem converge? If yes, in how many iterations?
Problem 2. (25 points)
a) (20 points) Use linear least squares to fit a linear model that predicts the yield from the given experimental data. Set up the problem by hand by specifying all matrices necessary to compute the coefficients. Write the Matlab code that shows all the steps needed to solve for vector of coefficients, a. The model should be of the form:
𝑦 = 𝑎A + 𝑎9𝑇 + 𝑎;𝑆 + 𝑎D𝐵
Hint: convert the Yes/No variables to integers with 1=Yes and 0=No.
Based on the value of the estimated coefficients, comment if you should use a reactor with baffles to boost the yield of your reactor.
b) (5 points) Compute standard deviation from the regression line and r2 value for the fit using Matlab. Are you satisfied with the model based on these computed values?
The yield from your lab-scale reactor, y, is a function of reactor
temperature, impeller speed and reactor type (one with with baffles and one without).
You have collected data (shown in Table below) from various experiments.
Problem 3 (40 points). The viscosity of sulphuric acid, 𝜐, varies with purity, p in the following manner:
a) (5 points) Express 𝜐(𝑝) as a quadratic function using Lagrange interpolating polynomials (by hand)
b) (5 points) Express 𝜐(𝑝) as a quadratic function using Newton interpolating polynomials (by hand).
c) (10 points) Write a Matlab code to fit a cubic spline through the data points and report your spline coefficients.
d) (5 points) Use Matlab to plot:
• the Newton interpolating polynomial
• the Lagrange interpolating polynomial
• the cubic spline,
• and the 3 data points on the same graph.
The plot should have labeled axis and a legend.
e) (15 points) What is the estimated viscosity at p = 40% purity using Newton,
Lagrange interpolation and cubic spline? You can either use Matlab, or perform calculations by hand. Which one of them has the closest estimate to the true value of 2.5 millipascal? What would you recommend to improve accuracy of the estimates?
Bonus question (3 points) The purpose of the homework in this class is to reinforce concepts emphasized in class, tutorials and reading materials. Write a sentence or two two stating the benefit or disadvantage (if any) of the group work in acquiring these concepts. In other words, state how did the group work enhance your learning (if it did) did) and what did you learn from each other. Note, that you can get bonus points only if only if you work in a group.