unit Calibration; interface uses System.SysUtils; type TCalibration = class private a, b: Double; // º¸Á¤½ÄÀÇ ±â¿ï±â¿Í ÀýÆí public constructor Create(xValues, yValues: TArray); function Calibrate(x: Double): Double; end; implementation { TCalibration } function TCalibration.Calibrate(x: Double): Double; begin Result := a * x + b; // º¸Á¤µÈ °ª °è»ê end; constructor TCalibration.Create(xValues, yValues: TArray); var i, N: Integer; sumX, sumY, sumXY, sumX2: Double; begin N := Length(xValues); if N <> Length(yValues) then raise Exception.Create('Input arrays must have the same length.'); sumX := 0; sumY := 0; sumXY := 0; sumX2 := 0; for i := 0 to N - 1 do begin sumX := sumX + xValues[i]; sumY := sumY + yValues[i]; sumXY := sumXY + xValues[i] * yValues[i]; sumX2 := sumX2 + xValues[i] * xValues[i]; end; a := (N * sumXY - sumX * sumY) / (N * sumX2 - sumX * sumX); b := (sumY - a * sumX) / N; end; end.