comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: how to create a LOG array from A to B
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: how to create a LOG array from A to B [message #79001 is a reply to message #78999] Thu, 12 January 2012 11:52 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 1/12/12 12:27 PM, nata wrote:
> Hello guys,
>
> If I want to create an array of N positions from A to B I can do it
> like this :
> result=FINDGEN(N)*(B-A)/(N-1)+A
>
> Right now I would like to create the same array but with a logaritmic
> "distribution" and for any positive A and B.
> For example, for A = 0, B = 1 and N=10 the result should be
> ALOG10(1+FINDGEN(10))
>
> This is easy if A and B are powers of 10 but I don't know how to solve
> this problem with any other numbers.
> Thnak you in advance for your help,
>
> nata

Just use your result at the top, but use 10.^a and 10.^b instead of a and b:

IDL> plot, alog10(findgen(n) * (10.^b - 10.^a) / (n - 1.) + 10.^a)

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: WIDGET_BASE: Unable to connect to X Windows display: :0.0
Next Topic: Re: Multiple parameters for ZEROFCN

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Dec 03 11:21:19 PST 2025

Total time taken to generate the page: 0.56292 seconds