knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

The underlying mathematical models that produces data to simulate Harvard spirometer tracing will be explained in the following sections.

\

Since the aim is to build a 2D plot with x-and y-position in milimeter, it requires a function to generate y-axis data from x-axis data and other physiologic parameters.

Therefore, the goal here is to build a function $f_{tracing}(x)$ that yields an output:

from inputs:

and physiologic parameters:

\

$f_{tracing}(x)$ can be decomposed into the sum of its 2 components: the respiratory waves function $f_{wave}(x)$ and the oxygen line function $f_{O_2line}$ that results from oxygen being consumed by the experimental subject (if the oxygen consumption ($\dot{V}_{O_2}$) is constant).

\

$$ f_{tracing}(x) = f_{wave}(x) + f_{O_2line}(x) $$

\

Next, I will provide methods to build $f_{wave}(x)$ and then $f_{O_2line}(x)$.

The Respiratory Waves Function

For simplicity, respiratory waves function $f_{wave}(x)$ will be modeled from trigonometric sinusoidal function. In this case, I will use the cosine function cos().

The general form of cosine function that models position $y$ as a function of the position $x$ can be written as:

\

$$ y(x) = A \times cos(k x) \ k = \frac{2\pi}{\lambda} $$

Where:

\

To model respiratory waves,

the amplitude of wave ($A$) in mm can be expressed in terms of tidal volume ($V_T$) in ml, given that 1 mm in the y-axis = 30 ml.

$$ A = \frac{V_T}{2 \times 30} $$

\

And, the wave length ($\lambda$) in mm can be expressed in terms of respiratory rate ($f_R$) in cycle/min and paper speed ($v_{paper}$) in mm/min.

$$ \lambda = \frac{v_{paper}}{f_R} $$

Therefore, the respiratory waves function $f_{wave}(x)$ can be written as:

\

$$ f_{wave}(x) = \frac{V_T}{60} \times cos(\frac{2\pi f_R}{v_{paper}} \times x) $$ \

Where:

The Oxygen Line Function

Assuming that the rate of oxygen used by the subject is constant, the function that represents oxygen consumption $f_{O_2line}$ could be modeled by the linear equation.

Since The simple linear equation is expressed in the following form:

$$ y(x) = \beta_0 + \beta_1 x $$

Where:

Modelling slope ($\beta_1$) in terms of the oxygen consumption ($\dot{V}{O_2}$) in L/hr and paper speed ($v{paper}$) in mm/min can be written as follows.

$$ \beta_1 = \frac{ \dot{V}{O_2} }{ v{paper} \times 30 } \times \frac{1000}{60} = \frac{5 \dot{V}{O_2} }{ 9 v{paper} } $$

Therefore, the linear function $f_{O_2line}$ which produces the oxygen line can be written as:

\

$$ f_{O_2line}(x) = \beta_0 + \frac{5 \dot{V}{O_2} }{ 9 v{paper} } \times x $$ \

Where:

The Harvard Spirometer Tracing Function

We have constructed the respiratory waves function $f_{wave}(x)$:

\

$$ f_{wave}(x) = \frac{V_T}{60} \times cos(\frac{2\pi f_R}{v_{paper}} \times x) $$ \

and, the oxygen line function $f_{O_2line}$.

\

$$ f_{O_2line}(x) = \beta_0 + \frac{5 \dot{V}{O_2} }{ 9 v{paper} } \times x $$

Since, the function that produces Harvard spirometer tracing $f_{tracing}(x)$ can be written as the sum of $f_{wave}(x)$ and $f_{O_2line}$:

$$ f_{tracing}(x) = f_{wave}(x) + f_{O_2line}(x) $$

substituting $f_{wave}(x)$ and $f_{O_2line}(x)$ with above equations yields the final equation that produce Harvard spirometer tracing.

\

$$ y(x) = f_{tracing}(x) = \frac{V_T}{60} . cos(\frac{2\pi x f_R }{v_{paper}}) + \frac{5 x \dot{V}{O_2} }{ 9 v{paper} } + \beta_0 $$

\

Where:


Last updated: r format(Sys.time(), '%d %B %Y')



Lightbridge-KS/rslab documentation built on Feb. 24, 2022, 1:36 a.m.