function y=sqrtnoise(x)
% Random noise whose amplitude is proportional to the square root of the
% amplitude of signal with white power spectrum with mean zero and unit
% standard deviation, equal in length to x.
% Tom O'Haver, 2012
z=sqrt(abs(x)).*randn(size(x));
sz=std(z);
y=z./sz;