Numerical simulation technology to assist the teaching of university physics is a higher education to continuously adapts to the social development of its own needs. This paper classifies the common forms of university physics courses involving numerical computation, explores the current computer simulation in physics teaching, and establishes the development process of the university physics computer numerical computation simulation program. Numerical simulation technology is applied to the design of university physics teaching, and two examples of numerical simulation technology assisting university physics teaching are designed from two cases of grating diffraction intensity distribution and gas diffusion based on Matlab. In Example N = 10, the light intensity distribution of diffraction grating with different slit numbers is analyzed by numerical simulation, and it is obtained that at 1, there are 9 minima between two adjacent main maxima, 8 sub-maxima, and the maximum value is 100, which verifies the theoretical results of the physical derivation of the grating diffraction intensity distribution. In the exposition, mathematical modeling is combined with examples to show that mathematical modeling can greatly exert the role of mathematical ideas in physics teaching, simplify physics teaching, and further cultivate students’ ability to solve practical problems.