I was looking for a way to generate a logarithmic spaced array in IDL. From the L3 Harris Geospatial website I came across "arrgen" and was trying to use it for this purpose. However,

arrgen(1,215,/log) 

returns the error: Variable is undefined: ARRGEN.

What would be the correct way to do it? Thanks in advance for your help

1

1 Answer

Start by defining your lower and upper bounds in which ever log-base you prefer. I will use base $e$ for brevity sake.

lowe = ALOG(low[0]) uppe = ALOG(upp[0]) 

where low and upp are scalar, numerical values you, the user, define (e.g., 1 and 215 in your example). Then construct an evenly spaced array of n elements, such as:

dinde = DINDGEN(n[0])*(uppe[0] - lowe[0])/(n[0] - 1L) + lowe[0] 

where n is a scalar integer. Now convert back to linear space to get:

dind = EXP(dinde) 

This will be a logarithmically spaced array. If you want to use base-10 log, then substitute ALOG for ALOG10. If you need another base, then you can use the logarithmic change of base rule given by:

logb x = logc x / logc b

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.