# Removing white noise by taking the mean of many samples

I'm learning about signal processing, and I am attempting to remove white noise from an output of a blackbox system.

As you can see from the above image (left is the input sin(t), right is the output) there is quite a bit of noise.
I am attempting to verify that it is white noise. To do, I have run the system 100 times with the same sin(t) input and have taking the mean of the outputs, which resulted in the following plot:

If it is white noise, I believe I should expect that the mean of many outputs will approximate the noise-free output for larger and larger sample sizes.

However, as you can see, there is still quite a bit of noise and I'm not too sure why. At first I thought the data between samples wasn't lining up when taking the mean, but I don't believe that should actually matter.

The variance of the white noise will go down by $$N$$ through averaging (or standard deviation will go down by $$1/\sqrt{N}$$, where the standard deviation as a magnitude quantity will be visually consistent with the "spread" of noise on the graphic the OP is looking at. Thus to make it visually reduce by a factor of 10, the OP would need to average 100 times (if it is indeed white noise).
Also be very careful in a simulation of white noise that the random number generator isn't actually creating the exact same sequence each time (in which there will be no change through averaging)- given the OP's plots I suspect that is what may be occurring here. This would be clear by inspecting each sample in successive runs. The other confirmation of a white noise process is to take compute the autocorrelation function on the waveform, which for the white noise component will be an impulse at $$\tau=0$$ (or experimental approximation of one, limited by the actual time duration of the signal, so a large spike proportional to duration of the signal, and very small everywhere else).