1
$\begingroup$

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

enter image description here

  • 1
    Why don't you record yourself with a microphone ?2011-12-01
  • 1
    [Respiratory rate?](http://en.wikipedia.org/wiki/Respiratory_rate)2011-12-01
  • 0
    @AlexandreC because I want a mathematical function which approximates the breath2011-12-01
  • 0
    @Jesse doesn't answer my question at all2011-12-01
  • 0
    I love how people downvote the question without explanation, and upvote comments that don't answer the question at all.2011-12-01
  • 0
    @justinhj, the reason they downvote is that Stack Overflow is about solving your problems with coding, not things like this. You can understand it better if you imagine who the people here are: **Programmers** (and not doctors) (And for the record, I didn't downvote)2011-12-01
  • 0
    @shahbaz appreciate your answer. I felt this was on topic since it is "a specific programming problem", I'm looking for a "software algorithm" and the answer is "practical, answerable problems that are unique to the programming profession". It is identical to questions like this one: http://stackoverflow.com/questions/8263616/gravity-with-air-time-acceleration-and-speed-gaining2011-12-01
  • 0
    Might be a better fit for http://dsp.stackexchange.com ?2011-12-01
  • 0
    @Paul R: What does respiratory rate have to do with signal processing?2011-12-01
  • 1
    Here's the relevant patent, for what it's worth. http://www.freepatentsonline.com/6658577.html2011-12-02

2 Answers 2

2

Your curves look like they could be approximated by exponentials. The first could be $1-\exp (\lambda_1 t)$ for $0, $\exp (\lambda_2 (t-3)t)$ for $3 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.

5

Just a search on google images:

enter image description here

If you like the first one, a lot of functions could look like that. For example, get partly cos(t)^3 and partly flat. Of course, with coefficients to adjust it.

  • 0
    Now that I look at it more closely, it looks odd. I mean, the Ideal pattern is 3 breaths/min? Never the less, the shape completely makes sense2011-12-01
  • 0
    does not look right. why would breathing be more sinusoidal when breathing quickly...?2015-09-18
  • 0
    Sinusoidal is essentially "inhale fast, short pause, exhale fast, short pause". This is a mechanical system, so pauses and smoothness are unavoidable. Looks right to me.2015-09-18
  • 0
    I guess my main objective is the shape of the function for breathing normally is fundamentally different from breathng "in the sick". I suspect actually measuring the chest move would be much more asymetric. It's a good start though!2015-09-18