This script allows the user to add noise to a spectrum, in a manner almost exactly opposite to smoothing data. The script random adds noise to each data point of a spectrum within the range of +/- a percentage of the highest to lowest point.
By default the script uses a value of 5%, so each data point will be randomized to a position + or - 5% of it’s original value (relative to the largest peak). However any value can be selected.
Syntax
[y_noise] = ADDNOISE (y)
Adds 5% noise to the spectrum ‘y’
[y_noise] = ADDNOISE (y,15)
Adds 15% noise to the spectrum ‘y’
This page previously appeared on morganbye.net[^1][^2][^3]
[^1:] http://morganbye.net/addnoise [^2:] http://morganbye.net/eprtoolbox/addnoise) [^3:] http://morganbye.net/uncategorized/2012/01/addnoise