In the following example we define general polynomial of second degree (three parameters) and also the procedure for derivatives:
// y=b0*x*x + b1*x + b2 i.e. parabola function SimpleParabola(const B: TVec; X: double): double; begin SimpleParabola := b[0]*Sqr(x) + b[1]*x + b[2]; end; // procedure for derivatives procedure SimplePabolaDeriv(RegressFun: TRegressFun; X, Y: double; const Pars: TVec; const Grad: TVec); begin Grad[0] := Sqr(x); Grad[1] := x; Grad[2] := 1; end; begin // ... MtxNonLinReg1.RegressFunction := SimpleParabola; MtxNonLinReg1.DeriveProcedure := SimpleParabolaDeriv; end;
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|