This project is based on a project by Brian Winkle. https://www.simiode.org/resources/2981/supportingdocs
To represent a bolus we want a function that "turns on" at just ONE value of $t$ and is "off" for all other values of $t$.
Here's one way to build such a function:
$$ f(t)= \begin{cases} \dfrac{1}{\epsilon} & 0 \leq t \leq \epsilon \\\\ 0 & t > \epsilon \\ \end{cases} $$and let $\epsilon \rightarrow 0$!!
The function that results is called the Dirac delta function, $\delta(t)$.
dirac
You can think of it this way: 5𝛿(𝑡−3) is 5 when 𝑡=3 and zero everywhere else. (This isn't really correct, but it helps to think of it this way.)
To represent continuous drip administration of the drug, but for no more than 1/2 hour each hour we want a function that turns on for awhile and then turns off for awhile, etc.
First, define: $$h(t)=\begin{cases} 0 & t<0 \\\\ 1 & t \geq 0 \\ \end{cases} $$
syms t
g(t)=heaviside(t);
fplot(g(t),[-3,3], "LineWidth",3)
If we want a function to turn on for awhile and then off we can combine heaviside functions. For example if we want the function to turn on at $t=2$, we use $h(t-2)$. Notice, $h(t-2)=1$ for $t$-values bigger than 2. So say we want the function to turn off at $t=5$, we just need to subtract 1 starting at $t=5$. So, we'll subtract $h(t-5)$. The function $g(t)=h(t-2)-h(t-5)$ will turn on at $t=2$ and off at $t=5$.
g(t)=heaviside(t-2)-heaviside(t-5);
fplot(g,[-5,8], "LineWidth",3)
It's easy to combine several heaviside functions to get a function and repeatedly goes on and off. Start with a simple one on, one off, of length one and height one:
$s(t)=h(t)-h(t-1)$
syms t h(t)
step(t)=heaviside(t)-heaviside(t-1)
fplot(step(t), [-1,3], "LineWidth",3)
Now, say we want the function to go on at $t=0$, $t=2$, $t=4$, etc. and have a magnitude of 3 instead of 1.
$$f(t)=3s(t)+3s(t-2)+3s(t-4)+ \cdots$$syms t f(t)
f(t)=3*step(t)+3*step(t-2)+3*step(t-4)
fplot(f, [-3,7], "LineWidth",3)
syms g(t) k
g(t)=symsum(step(t-2*k),k,0,10)
fplot(g, [-3,25], "LineWidth", 3)
These are just these "affine" transformations you learned in Precalculus: horizontal shifts, vertical shifts, horizontal compression/expansions, vertical compression/expansion.
Please do all of this homework on a separate sheet of paper. Do not use a printout of these slides.
Exercise 1
Give algebraic representations (formulas) for the graphs you sketched in Exercise 1 on the first day of class. Show both the graphs from last week as well as their formulas. These will almost certainly be written in terms of $\delta(t)$, $h(t)$, and $s(t)$.
Exercise 2
Give formulas for the functions in terms of $\delta(t)$, $h(t)$, or $s(t)$ for the graphs in the pdf: Plotone
Exercise 3 Sketch plots of each of the following: