According to what Marjan described here you could calculate y in PlotSmoothFit like this:
Code: Select all
y := coeffs[1] * x - coeffs[1] * MinXValue + coeffs[0] + MinYValue;
Code: Select all
y := Poly( x-MinXValue, coeffs ) + MinYValue;
Code: Select all
y := coeffs[1] * x - coeffs[1] * MinXValue + MinYValue;
Code: Select all
for i := 2 to imax do
coeffs[ i-1 ] := AnswerVector[ i ];
Code: Select all
procedure PlotSmoothFit( var serFit, serSmoothFit : tFastLineSeries;
FitFctn : TCurveFittingFunction;
smoothness : integer );
var interval, x, y : double;
i, imax : integer;
coeffs : array of double;
begin
with FitFctn do
begin
imax := PolyDegree;
SetLength( coeffs, imax );
for i := 2 to imax do
coeffs[ i-1 ] := AnswerVector[ i ];
end;
serSmoothFit.DataSource:=nil;
with serFit do
begin
interval := ( MaxXValue - MinXValue )/ smoothness;
for i := 1 to smoothness do
begin
x := MinXValue + (i-1) * interval;
y := Poly( x-MinXValue, coeffs ) + MinYValue;
//y := coeffs[1] * x - coeffs[1] * MinXValue + coeffs[0] + MinYValue;
serSmoothFit.AddXY( x, y );
end;
end
end;