Question: Part 1 Write a general MATLAB function for integrating experimental data using Simpson's 1/3 rule. Your function should check if there are an odd number

Part 1 Write a general MATLAB function for integrating experimental data using Simpson's 1/3 rule. Your function should check if there are an odd number of intervals, if there are, the trapezoidal rule should be used for the last interval. The first line of your MATLAB function should look like function I = Simpson . LastName (x,y) where the function numerically evaluates the integral of the vector of function valuesywith respect to 'x' Your matlab function should also include the following: Error check that the inputs are the same length Error check that the x input is equally spaced Warn the user (not an error, just a warning) if the trapezoidal rule has to be used on the last interval. Part 2 Two important quantities when studying fermentation are the carbon dioxide evolution rate (g/h) and the oxygen uptake rate (g/h). These are calculated from expiremental analysis of the inlet and exit gases of the fermentor, and the flow rates, temperature, and pressure of these gases. Using your function in part 1, and the data table below, calculate the total amount of carbon dioxide produced and oxygen consumed during fermentation. Compare to the value that the MATLAB function trapz (0 computes. Time of Fermentation (h) Carbon Dioxide Evolution Rate (g/h) Oxygen Uptake Rate (g/h) 140 15.49 141 142 143 144 15.72 15.53 15. 19 16.56 16.21 16. 16 15.35 15.13 14.20 Part 1 Write a general MATLAB function for integrating experimental data using Simpson's 1/3 rule. Your function should check if there are an odd number of intervals, if there are, the trapezoidal rule should be used for the last interval. The first line of your MATLAB function should look like function I = Simpson . LastName (x,y) where the function numerically evaluates the integral of the vector of function valuesywith respect to 'x' Your matlab function should also include the following: Error check that the inputs are the same length Error check that the x input is equally spaced Warn the user (not an error, just a warning) if the trapezoidal rule has to be used on the last interval. Part 2 Two important quantities when studying fermentation are the carbon dioxide evolution rate (g/h) and the oxygen uptake rate (g/h). These are calculated from expiremental analysis of the inlet and exit gases of the fermentor, and the flow rates, temperature, and pressure of these gases. Using your function in part 1, and the data table below, calculate the total amount of carbon dioxide produced and oxygen consumed during fermentation. Compare to the value that the MATLAB function trapz (0 computes. Time of Fermentation (h) Carbon Dioxide Evolution Rate (g/h) Oxygen Uptake Rate (g/h) 140 15.49 141 142 143 144 15.72 15.53 15. 19 16.56 16.21 16. 16 15.35 15.13 14.20
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
