I need to simulate & output the human heartrate BPM with real-world like values. I've been looking at a gaussian random approach but don't believe this fits my use case. I'm not concerned about the actual values only that they are uniformed & match the patterns of a monitored heart beat (i.e. increasing/decreasing uniformly)

the range is from 50-180 with linear increments/decrements with a single digit emitted every second e.g.


Any eloquent algorithms allow for this?

  • 1
    Maybe not. However, if you take measurements for different activitiy levels, you could attempt to use a best fit algorithm to derive the function you use for your average user. It really does depend on how you model the BPM in code though. May 10, 2019 at 13:23

1 Answer 1


they are uniformed & match the patterns of a monitored heart beat (i.e. increasing/decreasing uniformly)

Speaking as someone who uses a heart rate monitor, I think your understanding of how they work is incorrect.

First off, during steady-state activities the heart rate will remain in different fairly-narrow bands. For example, right now I'm sitting and typing, and my heart rate is 58 +/- 3; a few minutes ago I was walking around and it was 72 +/- 3. When I'm exercising it depends on speed and load: steady-state cruising on the bicycle might be in the 130-140 range, spiking to 165 during intervals or pushing up a hill (and from that you should be able to guess my age within 10 years).

So, I recommend that you first define some standard activity bands, and then define a timeline for transitions between those bands.

At any given second the heart rate would be a random value within the band (which should average to the center of the band). There's no need to get fancy here: a real-world heart rate monitor isn't that exact (particularly one in a wearable).

The transition between bands gets a little more interesting. I suspect that it follows a sine curve, although that very much depends on activity type (for example, when doing intervals I have a linear rise and sinusoidal decline). But if all you want to do is make a reasonable simulation, then I think that a linear transition would be sufficient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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