linspace() and logspace() functions in VBA
Everyone working with mathematical packages like MatLab or Python is quite probably familiar with the two functions linspace()
and logspace()
. These two functions offer very convenient ways to create arrays with linearly spaced or logarithmically spaced elements, respectively.
This article presents two User Defined Functions (UDF), providing the same functionalities in Excel and VBA. They offer the same flexibility concerning the inclusion of the endpoints or the choice of the log base as is illustrated in the NumPy Reference for the array creation routines.
For a graphical demonstration see the example screenshots, more detailed information are contained in the download files below.
Download Files
Note: The Excel file(s) are developed with MS Excel 2007; for compatibility reasons I add a *.xls version for pre Excel 2007 versions (which are not tested). Both files are in a ‘zipped’ format.