Problem 5 (35 points): As discussed in our last lecture, linear algebraic equations can arise in the solution of differe
Posted: Mon May 09, 2022 10:05 am
Problem 5 (35 points): As discussed in our last lecture, linear algebraic equations can arise in the solution of differential equations. The following differential equation results from a steady- state mass balance for a chemical in a one-dimensional canal, d²c 0 = D dc U dx kc dx2 = where x = distance along the canal (m), c= concentration, t = time, D = diffusion coefficient, U fluid velocity, and k = a first-order decay rate. - = = (a) Convert this differential equation to an equivalent system of simultaneous algebraic equations using centered difference approximations for the derivatives. (b) Develop a MATLAB function to solve these equations from x = 0 to L and return the resulting distances and concentrations. The first line of your function should be function (x,c] = reactor(D, U, K, CO, CL, L, dx) (c) Develop a MATLAB script that invokes this function and then plots the results. (d) Test your MATLAB script for the following parameters: L = 10 m, Ax = 0.5 m, D = 2 m²/d, U= 1 m/d, k = 0.2/d, c(0) = 80 mg/L, and c(10) = 20 mg/L. = =