≡ ▼
Work in Progress :: Please contact us to report errors, typos, etc.
=L_LOGSPACE(start, end, n)
ArgumentDescriptionExample
startThe first value as the nth power of 10: (10^start)1
endThe last value as the nth power of 10: (10^end)3
nNumber of values in the vector21

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)) )
)
Warning
These L_LOGSPACE functions are not compatible between Excel and Google Sheets. Use the function code specific to your software.

L_LOGSPACE Examples

Example 1
Generate a vector of 11 x-values between 10 and 1000 so that they appear evenly spaced when viewed on a logarithmic scale.
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}
LOGSPACE vs. LINSPACE Example
Example 2
Generate a vector of 11 logarithmically spaced values between 100 and PI().
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

Disclaimer: This article is meant for educational purposes only. See the License regarding the LAMBDA code, and the site Terms of Use for the documentation.