Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Dec 1 '11 at 23:36

This question came from our site for professional and enthusiast programmers.

1  
Why don't you record yourself with a microphone ? –  Alexandre C. Dec 1 '11 at 20:51
1  
Respiratory rate? –  Jesse Dec 1 '11 at 20:52
    
@AlexandreC because I want a mathematical function which approximates the breath –  justinhj Dec 1 '11 at 20:55
    
@Jesse doesn't answer my question at all –  justinhj Dec 1 '11 at 20:56
1  
Here's the relevant patent, for what it's worth. freepatentsonline.com/6658577.html –  Harry Stern Dec 2 '11 at 0:04

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
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 sense –  Shahbaz Dec 1 '11 at 20:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.