0001 function rrand=seterrorrand(...
0002 r,...
0003 positions,...
0004 errorsetfunct,...
0005 seed,...
0006 sigma,...
0007 nsigma,...
0008 exixstingerrval)
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 if sigma==0
0027 sigma=1e-15;
0028 end
0029
0030 if nsigma<0
0031 nsigma=2;
0032 end
0033
0034 if seed~=0
0035 disp(['Setting Random Stream to seed: ' num2str(seed)]);
0036
0037 s = RandStream('mcg16807','Seed',seed);
0038 RandStream.setGlobalStream(s);
0039 else
0040
0041 end
0042
0043
0044 errorvalues=TruncatedGaussian(...
0045 sigma,...
0046 nsigma*sigma, ...
0047 size(positions));
0048
0049 if ~isrow(errorvalues)
0050 errorvalues=errorvalues';
0051 end
0052
0053
0054 if nargin<7
0055 exixstingerrval=zeros(size(errorvalues));
0056 end
0057
0058 if ~isrow(exixstingerrval)
0059 exixstingerrval=exixstingerrval';
0060 end
0061
0062
0063 rrand=errorsetfunct(r,positions,exixstingerrval+errorvalues);
0064
0065 return
0066
0067