When the quality of liquid ammonia is measured by volumetric flowmeter, the traditional quadratic expression method can't meet the accuracy of temperature compensation in modern coal chemical industry. So the temperature compensation method by support vector machine (SVM) regression is presented, and kernel function parameter σ of SVM is optimized by variable weight particle swarm optimization (PSO). After the performance analysis and comparison in PSO, the suitable linear inertia weight method is selected. Experimental results show that the temperature compensation accuracy of the SVM method based on the variable weight PSO is significantly higher than that of the traditional quadratic expression method.