为提高导轨平面度误差的计算精度与效率,本文提出基于最小二乘法的平面拟合算法,通过数学建模与优化方法实现平面度误差的高精度评估。详细推导了最小二乘法平面拟合的数学模型,并给出算法实现流程及测试结果。实验表明,该方法计算简单、结果可靠,适用于工业检测中的平面度分析。To improve the calculation accuracy and efficiency of flatness error of guideways, this paper proposes a plane fitting algorithm based on the least squares method, which achieves high-precision evaluation of flatness error through mathematical modeling and optimization. The mathematical model of least squares plane fitting is derived in detail, and the algorithm implementation process and test results are provided. Experiments show that this method is simple in calculation, reliable in results, and suitable for flatness analysis in industrial inspection.