SharpPlot Tutorials > Style Examples > Force modelfit through zero

Force modelfit through zero

The fitted model is forced to have zero intercept on both axes.


sp.SetOrderOfFit(2,2);
sp.EquationStyle = EquationStyles.Middle|EquationStyles.Below|EquationStyles.ForceOrigin;
sp.EquationFormat = "y = C0 + C1x + C2x²";

If the order of fit is 1, this corresponds to the LNT (Linear No Threshold) model which is used by default when there is insufficient information to support a more realistic scenario.

Note that the zeroth term in the equation formatter is eliminated for you..

See also ...

Model fit | SharpPlot.EquationFormat Property | SharpPlot.SetOrderOfFit Method


Send comments on this topic
© Dyalog Ltd 2021