2023 Summer Computing Methods Homework # 4 (100)
Problem #1 ( 25)
The population of the world for selected years from 1750 to 2009 is given in the following table:
A. Determine the function that best fits the data. Use the function to estimate the population in 1984. Make a plot of the points and the function. B. Fit the data with a third-order polynomial. Use the polynomial to estimate the population in 1984. Make a plot of the points and the polynomial fitting curve . C. Fit the data with linear and spline interpolations. Estimate the population in 1984 with linear and spline interpolations. Make a plot of the data points and curves made of the interpolated points.
In each part make a plot of the data points (circle markers) and the fit curve or the interpolation curves. Note that part c) has two interpolation curves.
Problem #2 ( 25)
The standard air density, D (average of measurements made), at different heights, h, from sea level up to a height of 33 km is given below.
Make the following four plots of the data points (density as a function of height):
- both axes with linear scale;
- h with log axis, D with linear axis;
- h with linear axis, D with log axis;
- both log axes. According to the plots choose a function (linear, power, exponential, or logarithmic) that best fits the data points and determine the coefficients of the function.
Plot the function and the points using linear axes.
Problem #3 ( 25)
Write a user -define d function that fits data points to a power function of the form =𝑏𝑥𝑚 . Name the function [b,m] = powerfit(x,y) , where the input arguments x and y are vectors with the coordinates of the data points, and the output arguments b and m are the constants of the fitted exponential equation. Use powerfit to fit the data below. Make a plot that shows the data points and the function.
The following model applies to third -order chemical reactions in batch reactors:
𝑐= 𝑐01 √1+2𝑘𝑐02𝑡
where c - concentration (mg/L), c 0 - initial concentration (mg/L), k - reaction rate (L2 /(mg2 d)), and t - time (d). Linearize this model and use it to estimate k and c 0 based on the following data
t 0 0.5 1 1.5 2 3 4 5 c 3.26 2.09 1.62 1.48 1.17 1.06 0.9 0.85
Develop plots of your fit along with the data for both the original and the linearized equations.
Bonus Problem ( 5)
The relationship between two variables P and t is known to be 𝑃=𝑚𝑡 𝑏+𝑡. The following data points are given
Determine the constants m and b by curve-fitting the equation to the data points. Make a plot of P versus t. In the plot show the data points with markers and the curve-fitted equation with a solid line. (The curve fitti ng can be done by writing the reciprocal of the equation and using a first -order polynomial.)