In this paper, the WIFI localization algorithm based on the signal intensity feature matching is studied and combined with the mathematical optimization strategy. By constructing accurate mathematical models, the algorithm can process signal intensity data more accurately and reduce the influence of environmental factors on the localization results. This positioning strategy based on mathematical optimization not only improves the positioning accuracy, but also improves the stability and practicability of the system, and provides an innovative technical means for the classroom roll call system in universities, which has important practical value and promotion prospects.