Computational Performance of MATLAB and Python for Electromagnetic Applications


  • Alec Weiss Department of Electrical Engineering Colorado School of Mines Golden, Colorado
  • Atef Elsherbeni Department of Electrical Engineering Colorado School of Mines Golden, Colorado


Computational electromagnetics, GPU programming, MATLAB, python


MATLAB and Python are two commonly used scripting languages for prototyping electromagnetic problems today. Each of these languages provides access to computationally efficient functions allowing a user to easily run many math heavy problems with minimal programming. In this paper we will discuss the usage of MATLAB and a variety of libraries in Python capable of running these efficient computations. Tests will be run in both languages to compare both CPU and GPU computations. The runtimes of a variety of problems using each of these platforms will also be compared for a variety of mathematical operations typically used in electromagnetic problems. Finally, a simple angle of arrival calculation using conventional beamforming will be performed to show these speeds on a realistic problem.


A. J. Weiss, A. Z. Elsherbeni, V. Demir, and M. F. Hadi, “Using MATLAB’s Parallel Processing Toolbox for Multi-CPU and Multi-GPU Accelerated FDTD Simulations,” vol. 34, no. 5, p. 7, 2019.

M. Capek, P. Hazdra, J. Eichler, P. Hamouz, and M. Mazanek, “Acceleration Techniques in Matlab for EM Community,” in 2013 7th European Conference on Antennas and Propagation (EuCAP), 2013, pp. 2639-2642.

J. Unpingco, “Some Comparative Benchmarks for Linear Algebra Computations in Matlab and Scientific Python,” in 2008 DoD HPCMP Users Group Conference, 2008, pp. 503-505.

J. Ranjani, A. Sheela, and K. P. Meena, “Combination of NumPy, SciPy and Matplotlib/Pylab - A Good Alternative Methodology to MATLAB - A Comparative Analysis,” in 2019 1st International Conference on Innovations in Information and Communication Technology (ICIICT), 2019, pp. 1-5.

P. Vouras, et al., “Gradient-Based Solution of Maximum Likelihood Angle Estimation For Virtual Array Measurements,” in 2018 IEEE Global Conference on Signal and Information Processing (GlobalSIP), 2018, pp. 1257-1261.