I want to animate something with the same frequency that a human breathes in and out, something like the Apple Macbook power light when it is in sleep mode.
So basically an ease in ease out function over time, but that has a curve that approximates the way a human breathes.
Edit: I just need the algorithm as a function of time, don't care which language.
Pretty close graph of what I need on this page:
http://www.normalbreathing.com/d/etco2-capnography.php


Your curves look like they could be approximated by exponentials. The first could be $1-\exp (\lambda_1 t)$ for $0<t<3$, $\exp (\lambda_2 (t-3)t)$ for $3<t<5$ then repeat. Choose the $\lambda$s to make it look right. For the hyperventilation, change the range of $t$s appropriately. The easiest way to set the $\lambda$s is to look for the $\frac{1}{e}$ point, where the signal is about $0.37$ of the final value and set $\lambda$ to the inverse of that time.