0001 function rwave=seterrorwave(...
0002 r,...
0003 positions,...
0004 errorsetfunct,...
0005 wavelength,...
0006 amplitude,...
0007 existingerr)
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 if nargin<6
0021 existingerr=zeros(size(positions));
0022 end
0023
0024 nw=length(amplitude);
0025 np=length(positions);
0026
0027 spos=findspos(r,positions);
0028
0029
0030
0031 sposdivwave = bsxfun(@rdivide, repmat(spos,nw,1), wavelength');
0032 sinsposdivwave=sin(2*pi*sposdivwave);
0033
0034 sinusoidsmat=repmat(amplitude,np,1).*sinsposdivwave';
0035 errorvalues=sum(sinusoidsmat,2)';
0036
0037
0038
0039
0040 rwave=errorsetfunct(r,positions,existingerr+errorvalues);
0041
0042 return