-1

Is there any technique or package that calculates Root Mean Square(RMS) in Flutter?

I searched many blogs and packages but didn't find useful resource related to RMS implementation in Dart

paul
  • 519
  • 6
  • 13

1 Answers1

0

This is the steps of Root Mean Square according to the link in the below:

Step 1: Get the squares of all the values

Step 2: Calculate the average of the obtained squares

Step 3: Finally, take the square root of the average

and this is the Dart implementation :

import 'dart:math';

void main() {
  List<int> values = [1,3,5,7,9];
  num result = 0;
  num rootMeanSquare = 0;
  
  for( var i = 0 ; i < values.length; i++ ) { 
      result = result + (values[i] * values[i]);
   }
  rootMeanSquare = sqrt(result / values.length);
  print(rootMeanSquare);

}

https://byjus.com/maths/root-mean-square/#:~:text=Root%20Mean%20Square%20Formula&text=For%20a%20group%20of%20n,x%20n%202%20%20N

jamesdlin
  • 81,374
  • 13
  • 159
  • 204
feyzforall
  • 26
  • 4