Skip to main content
. 2020 Dec 23;26(1):20. doi: 10.3390/molecules26010020
Algorithm 3 Simulation Algorithm Using Random Function (Matlab)
pos=zeros(1000,46); % class +
neg=zeros(1000,46); % class –
Aa=zeros(1000,46); % class Aa
i=1;
Thd=20;
while i < 1001
      b=aleat(0.02,0.5); % parameter b
      Cqp=aleat(10,40); % Cq for +
      Cqn=aleat(41,100); % Cq for –
      Ap=aleat(40,2000); % parameter Ap
      j=1;
     Cmp=((log((Ap/Thd)-1))/b)+Cqp;
     Cmn=((log((Ap/Thd)-1))/b)+Cqn;
     while j < 47
       pos(i,j)=(Ap./(1+exp(-b. * (j-Cmp))))+(Thd * rand()/3);
       neg(i,j)=(Ap./(1+exp(-b. * (j-Cmn))))+(Thd * rand()/3);
       if j<5
       Aa(i,j)= aleat(Thd,Ap);
        else
       Aa(i,j)= aleat(10 * Thd,2 * Ap);
        end
       j=j+1;
      end
     % data smoothing
     Aa(i,:)=(Aa(i,:)+((circshift(Aa(i,:)′,1)′))+((circshift(Aa(i,:)′,2)′))+((circshift(Aa(i,:)′,3)′)))./4;
     Aa(i,:)=(Aa(i,:)+((circshift(Aa(i,:)′,1)′))+((circshift(Aa(i,:)′,2)′))+((circshift(Aa(i,:)′,3)′)))./4;
     % offset referring to the initial intensity
     Aa(i,:)=Aa(i,:)-mean(Aa(i,1:4));
     i=i+1;
end
Xa=[pos; neg; Aa]