CEE 384 –77036 Numerical Methods for Engineers
Arizona State University
School of Sustainable Engineering and The Built Environment Dr. Lou
ML Assignment #8
Released: 11/12/2015 Due: 11/19/2015
This assignment includes the use and programming of MATLAB integration functions.
Write code of your own and answer the questions in this assignment. Include your answers in your report.
•Please read “MATLAB Assignment Submission Guidelines” in the Blackboard before submission.
•Not following the guidelines will result in loss of credit, even though you may have the correct answer(s).
In an attempt to understand the mechanism of the depolarization process in a direct methanol fuel cell (DMFC), an electro -kinetic model for mixed oxygen-methanol current on platinum was developed in the laboratory at Florida A&M University (read more about DMFC in KK book Ch 07.00B). A simplified model of the reaction developed suggests a functional relation in an integral form:
+6.725×10^−8+7.26×10^−4𝐶𝑚e / 3.62×10^−12𝑥+3.908×10^−8𝑥𝐶𝑚e ] d
𝑇 = Time it takes to consume certain amount of oxygen concentration in the fuel cell, sec
𝑥 = Concentration of oxygen, moles/cm^3,
𝑥1= Initial concentration of oxygen, moles/cm^3
𝑥2= Concentration of oxygen after T seconds, moles/cm^3
𝐶𝑚e = Concentration of methanol, moles/cm3,
0.2×10^−6≤ 𝑥 ≤ 1.22×10^−6 moles/cm^3
Write a MATLAB code to evaluate the time required for the initial oxygen concentration to be reduced by half (𝑥2 = 𝑥1/2) in the fuel cell using various numerical integration methods. Your code should prompt the user to enter the concentration of methanol (𝐶𝑚e) and the initial concentration of oxygen (𝑥1). Note that 𝐶𝑚e and 𝑥1 should be real numbers within their respective valid range: 0 ≤ 𝐶𝑚e ≤ 5 × 10^−4, and 0.2 × 10^−6 ≤ 𝑥1 ≤ 1.22 × 10^−6. In order to apply the trapezoidal rule and the Simpson’s 1/3 rule, your code should also prompt the user to enter the number of intervals desired. Keep in mind that for Simpson’s 1/3 rule, the number of intervals must be even.
1)Evaluate the integral using the ‘int’ command. Remember that you need to define a symbolic function in order to use the ‘int’ command.
2)Evaluate the integral using the ‘integral’ and the ‘quadgk’ command. Remember that these two commands require a function handle as one of the input arguments.
3) Evaluate the integral using ‘trapz’ command. Compute the input vectors to the ‘trapz’ command according to the number of intervals desired entered by the user.
4) Write your own code to implement Simpson’s 1/3 rule and evaluate the integral. Use the number of intervals desired entered by the user.
5) Print the results on screen. The display should include both the input parameters (𝐶𝑚𝑒, 𝑥1, and the number of intervals) and the results from 1) to 4). The display should be professionally formatted and the precision of the display controlled.
6) Analyze the results from 1) to 4). Employ the concepts of errors you have learned in this course
and discuss the accuracy of these results. Explain why certain methods are more accurate than
others. Explore how the results from 3) and 4) change as you vary the number of intervals.
7) Plot time vs. oxygen concentration for a range of 𝑥1 values (0.2 × 10^−6 ≤ 𝑥1 ≤ 1.22 × 10^−6) for 𝐶𝑚e= 3.5 × 10^−4 moles/cm^3. Initial oxygen concentration (𝑥1) should be on the x-axis and time is on the y-axis.