In ensemble averaging, n sets of data are obtained and averaged together to reduce random fluctuations in the signal. The signal-to-noise ratio (S/N) is proportional to the square root of the number of scans (n1/2).
In this simulation 200 points of Gaussian white noise are generated, and a user-defined "signal" level is added to point #100. The entire array is plotted and the S/N ratio is calculated by dividing the new value of point #100 by the standard deviation of the noise. This process is repeated n times at a user-defined rate. After each iteration (scan), an average of all scans is displayed, along with the overall S/N ratio and a plot of S/N vs n1/2.
(Reference: Skoog, Holler, and Crouch Principles of Instrumental Analysis, 6th Ed Thomson Brooks/Cole 2007)