Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. --Global--
  2. double total = 0, totalSq = 0;
  3. double stdev = 0, var;
  4.  
  5. --Loop--
  6. total += sample;
  7. totalSq += pow(sample, 2);
  8. double mean = total/nSmpl;
  9. if (nSmpl > 1)
  10.   var = (totalSq - pow(total, 2)/nSmpl)/(nSmpl - 1);
  11. stdev = sqrt(var);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement