add percent % noise to each value
====================================
percent=.03;
sample = sampleMatrix(index, :);
noiseSample=[];
for i=1 :instanceSize
val = sample(i);
smallPerc = val * percent ; % 1 percent noise add
noise = smallPerc* [ rand(1) - 0.5 ]; % .*T
noisyVal = val + noise ; % small is very small 10e-9
noiseSample = [noiseSample noisyVal];
end
noiseMatrix = [ noiseMatrix ; noiseSample];
Add little noise to X
======================
X
rand( 'state', 0 ) % any number for random number
randn('state', 0 ) % any number for random number
small = 10e-11
small* [ rand(size(X)) - .5 ] .* X + X % small is very small 10e-9
index = ceil(a + (b-a).*rand(1) ); %
Comments
Post a Comment