LAB 7: VOLUME OF A HEART AND LEAST SQUARE APPROXIMATION
Mathematics:
Experimental and numerical data do not generally fit to theoretical dependences because of experimental and numerical errors. If the error of data detection is sufficient small, data points are expected to resemble a theoretical curve. This assumption enables us to approximate parameters of a theoretical formula by computing the leastsquare approximation between a theoretical curve and real (experimental and numerical) data points. If the theoretical curve is simply a polynomial, the leastsquare approximation is a polynomial approximation. In many modelling problems, the theoretical curve is however expressed by exponential, logarithmic, power, and trigonometric functions, i.e. the leastsquare approximation is a nonlinear approximation. This project exploits the leastsquare approximation with an exponential function for an applicational modelling problem in medical science.
Consider a cardiology research unit that performs an experiment in which a dye is injected at a constant rate into the vein that empties directly into the heart. Small samples of blood are withdrawn at regular intervals from the artery that carries blood directly out of the heart. Concentration of the dye in the heart's blood was found in two trials as a function of time:
Trial I:
Concentration 
0.0243291 
0.0368201 
0.0465258 
0.0480842 
0.0499363 
Time in sec 
2.0 
4.0 
8.0 
12.0 
20.0 
Trial II:
Concentration 
0.0141734 
0.031606 
0.0405562 
0.0482163 
0.0496632 
Time in sec 
1.0 
3.0 
5.0 
10.0 
15.0 
The mathematical model for concentration of dye in the heart c=c(t) is:
c(t) = r_{in}/r_{out}
(1 – exp(r_{out}t/V))
where V is the volumne of the heart in mL,
r_{in }is the total amount of dye pumped in the heart per
second, and r_{out} is the total amount of blood pubped
out of the heart per second. We assume r_{in} = 5
mL/sec and r_{out} = 100mL/sec. In
order to determine V, we have a set of five data points (t_{k},c_{k})
and fixed values for parameters r_{in} and
r_{out}. By regrouping terms of the formula for c(t) and
taking a logarithm, we reduce the formula for c(t) to a linear
formula for t = t(c):
t =  V*log(1 – r_{out }c/r_{in}) / r_{out}
The linear leastsquare approximation can now be used to
find a value for V from the two sets of five data points for t
versus d = log(1 – r_{out }c / r_{in} ).


The first data set
results in the least square approximation for the volume of a heart: V = 311.25 ml with the total square error E = 4.09. The second data set
results in the least square approximation V = 299.99 ml with
the total square error E = 0.00. Therefore, the second data set is more
accurate for the theoretical dependence c = c(t).
Objectives:
·
understand
the computational algorithm for nonlinear leastsquare approximations
·
exploit
linear leastsquare approximations by solving a linear overdetermined system
·
exploit
MATLAB polynomial functions and leastsquare approximations
t =  V*d, d = log(1 – r_{out }c/r_{in}) / r_{out}
Steps
in writing the MATLAB script:
Exploiting
the MATLAB script:
t = a_{1}(d) + a_{2}, a_{1} = V, a_{2} = t_{0}, d = log(1 – r_{out }c/r_{in}) / r_{out}
Steps
in writing the MATLAB script:
Exploiting
the MATLAB script:
Consider
the same problem as in Script #2 of Lab. # 2, i.e. the random
walk of N molecules after n collisions. The
diffusion theory predicts that_{} = 0 and _{}^{2} = D n, where D is
diffusion coefficient, _{} is the mean and _{}^{2} is the variance:
_{} = _{}_{}x_{k}^{(n)}, _{}^{2 }= _{}_{}( x_{k}^{(n) }  _{} )^{2}
Evolution
of the mean_{} and the variance_{}^{2} in time n depends on the
number of molecules N in a statistical ensemble, as well as on
each particular random data realization. A typical pattern for evolution of the
mean_{} and the variance_{}^{2} for 10 different ensembles
with different values of N is shown here:


The
coefficient of diffusion D can be computed as the slope of the
leastsquare approximation of the curve_{}^{2} in time n. The basic
script with computations of _{} and _{}^{2} is attached. Continue the script and
compute the coefficient of diffusion for an ensemble of N = 500 molecules.