unit Peak; interface const cMassScale=1000; cSignalScale=1000; type tMass=cardinal; tSignal=extended; tPeak = class private Center :tMass; Sigma :tMass; Amplitude :tSignal; public constructor Create; destructor Destroy; function Signal(m:tMass):tSignal; property CenterPeak:tMass read Center write Center; property AmplitudePeak:tSignal read Amplitude write Amplitude; property SigmaPeak:tMass read Sigma write Sigma; end; implementation uses Math; //***************************************************************************** // //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- constructor tPeak.Create; begin Center:=0; Sigma:=0; Amplitude:=0; // Noise:=1; end; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- destructor tPeak.Destroy; begin end; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- function tPeak.Signal(m:tMass):tSignal; const cSqrt2PI=2.5066282746310005024; var s:extended; begin s:=0; if m>centerpeak then s:=m-CenterPeak else s:=CenterPeak-m; s:=Amplitude*(exp(-0.5*Power(s/SigmaPeak,2)/2)/(cSqrt2PI*SigmaPeak)); // if Noise>0 then s:=s+(Noise/cNoiseScale)*random; Result:=s; end; //----------------------------------------------------------------------------- end.