Suunto app Forum Suunto Community Forum
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Trailing HR / moving average HR - and a question on eliminating HR spikes

    Scheduled Pinned Locked Moved Suunto Plus Development
    1 Posts 1 Posters 30 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      DonTomGot
      last edited by

      To smoothen HR and minimize fluctuations I have previously used (Ambit2) trailing HR - but it seems it now needs to be calculated. As I had some problems in succeeding with this pretty simple task I thought someone else might benefit from my findings/hypothesis.

      Initially I tried this, to achieve a trailing (5s) heartrate:

      function evaluate(input, output) {
      
      HRacc5.shift(); //shifts the array one step left
      
      HRacc5[4] = input.HRCurrent; //adds current heart rate to index 4 in array
      
      var calculateAverage = function(arr) {
          var sum = 0;
          for (var i = 0; i < arr.length; i++) {
              sum += arr[i];
          }
          return sum / arr.length;
      }
      
      var HRavg5 = calculateAverage(HRacc5);
      
      output.RecalcAvgHR = 60 * HRavg5;
      

      Which worked well in the simulator. But IRL it did not work at all. The watch froze after a couple of minutes in all workouts and it became quite frustrating since troubleshooting on watch seemed advanced - and I am not advanced.

      As the watch seemed to freeze at very random points - sometimes 20 mins into a workout - I came to the conclusion that perhaps the input causes friction, as it works in the simulator? the hypothesis is now that unregistered heartbeat returns ‘undefined’ so next attempt was the inclusion of:

      HRacc5 = HRacc5.filter(Number);
      

      Supposedly filtering out everything that is not recognized as numbers.

      Now the app worked!

      (writing this primarily to avoid repeating the same frustrating workouts again, and potentially help others with similar ideas)

      Second topic: Sometimes (often when tired/poor sleep quality/hung over) I get heart rate spikes that I would like to eliminate. I would imagine that they can be identified as rapid elevations in heart rate where also the trailing heart rate can be a good baseline. But how could an algorithm be designed to eliminate these spikes with minimum disturbance to the trailing HR? All input most welcome!

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post

      Suunto Terms | Privacy Policy