Search code examples
delphicurvecurve-fitting

Delphi algorithm to solve 4 or 5 parameter logistics equation?


I'm looking for an [Pascal/Delphi] algorithm that can solve a 4 or 5 parameter logistics equation. I've been searching the web for quite a while now and have not been successful in finding an algorithm that works.

For example, 4 parameter logstics;

Y = (A-D)/(1+(x/C)^B)+D

Given a set of coordinates (x,y) I'd need to determine A, B, C, D. (A = max, B = slope, C = inflection point, D = min)

Any help in the right direction? :(


Solution

  • You can use non-linear curve fitting library, e.g. using Levenberg-Marquardt algorithm.

    I've already used this C open source library, very easy to interface with Delphi (after compilation with BC++ compiler).

    This code is based on standard lmfit well-known implementation of the algorithm, and perfectly resolve 4PL or 5PL equations. I've used this library in high-value biological software, including full validation using NIST reference material. I can not include the Delphi code here (this is copyrighted) but the C source code is ready to be downloaded above, and easy to work with (just one .obj file to include - or make a pure Delphi conversion).

    You have several paid libraries around, but I did not find anything better, faster, or more accurate than lmfit.