L_LOGSPACE
=L_LOGSPACE(start, end, n)
Argument | Description | Example |
---|---|---|
start | The first value as the nth power of 10: (10^start) | 1 |
end | The last value as the nth power of 10: (10^end) | 3 |
n | Number of values in the vector | 21 |
In the template file, navigate to the Sequences worksheet to see the L_LOGSPACE function in action.
Description
LOGSPACE refers to "logarithmic spacing" and the function is equivalent to 10^LINSPACE(start,end,n). The L_LOGSPACE function creates a vector of values that are evenly spaced on a logarithmic scale (base 10). The points will be spaced on the interval [10^start, 10^end], so the parameters for the function are the nth powers of 10.
There are many situations in science, finance, and engineering where data spans many orders of magnitude. Examples include astronomical distances, energy release in earthquakes, inflation, investment returns, growth rates of populations, decibel levels, pH levels, and pollutant concentrations.
Although many responses are logarithmic, the LOGSPACE function is particularly useful when you need to define the inputs for a model where the input is logarithmic (frequency, decibel, concentration, etc.). An example is in digital signal processing where you may want to create a vector of evenly spaced frequencies.
Lambda Function Code
This code for using L_LOGSPACE in Excel is provided under the License as part of the LAMBDA Library, but to use just this function, you may copy the following code directly into your spreadsheet.
Code to Create Function via the Name Manager
Name: L_LOGSPACE Comment: Create a vector with n logarithmically spaced points Refers To: =LAMBDA(start,end,n, LET(doc,"https://www.vertex42.com/lambda/logspace.html", 10^SEQUENCE(n,1,start,(end-start)/(n-1)) ))
Code for AFE Workbook Module (Excel Labs Add-in)
/** * Create a vector on interval [10^start,10^end] with n logarithmically spaced points * L_LOGSPACE(1,2,5) = {10; 17.8; 31.6; 56.2; 100} */ L_LOGSPACE =LAMBDA(start,end,n, LET(doc,"https://www.vertex42.com/lambda/logspace.html", 10^SEQUENCE(n,1,start,(end-start)/(n-1)) ));
Named Function for Google Sheets
Name: L_LOGSPACE Description: Create a vector with n logarithmically spaced points Arguments: start, end, n (see above for descriptions and example values) Function: LET(doc,"https://www.vertex42.com/lambda/logspace.html", ARRAYFORMULA( 10^(start+(end-start)*(SEQUENCE(n)-1)/(n-1)) ) )
L_LOGSPACE Examples
Test: Copy and Paste this LET function into a cell =LET( start, 1, end, 3, n, 11, L_LOGSPACE(start,end,n) ) Result: {10; 15.85; 25.12; 39.81; 63.1; 100; 158.49; 251.19; 398.11; 630.96; 1000}
Test: Copy and Paste this LET function into a cell =LET( start, 2, end, LOG(PI()), n, 11, L_LOGSPACE(start,end,n) ) Result: {100; 70.75; 50.05; 35.41; 25.05; 17.72; 12.54; 8.87; 6.28; 4.44; 3.14}
See Also
SE, LINSPACE, LOGSPACE, RESCALE, MESHGRID