numerical method HW using matlab with resdiual error
BME 301 Numerical Methods in Biomedical Engineering HOMEWORK 7 DUE March 22, 2017, 11:59 pm. Late policy: 20% deducted each late day.
The following data were obtained by measuring the length of a hydrogel patch immersed in 1.0M KCl solution as the temperature of the solution increased. All questions in this homework relate to these data. Show all MATLAB code.
1. [1 point] Using MATLAB, plot the length as a function of temperature. 2. Complete the following using MATLAB.
a. [3 points] Use the MATLAB command polyfit, fit a linear curve to the data and state the equation of best fit for the data.
b. [1 point] What is the value of the residual error at T=37 C? c. [1 point] What is the residual sum of square error (Et) for your fit? d. [2 points] Add the linear fit to the MATLAB figure.
3. Repeat the process for a quadratic fit: a. [3 points] Use the MATLAB command polyfit, fit a quadratic curve to the data and state the
equation of best fit for the data. b. [1 point] What is the value of the residual error at T=37 C? c. [1 point] What is the residual sum of square error (Et) for your fit? d. [2 points] Add the quadratic fit to the figure of 2(d)
4. Now use spline fits. a. [3 points] By hand, calculate the equations for linear splines that could be used to interpolate
values between 36 and 37 C and 37 and 38 C. Using the equation between 37 and 38 C, compute the length at 37.1 C.
b. [2 points] Using the MATLAB command spline, and natural boundary conditions (state what these are) find the length of the gel at 37.1 C.
Temperature, T (C) Length (mm)
30 5.60 31 5.75 32 5.82 33 5.87 34 5.90 35 5.92 36 5.94 37 5.94 38 5.95 39 5.96 40 5.97 41 6.00 42 6.03