Re: what is the dist function's mean? [message #43744 is a reply to message #43549] |
Fri, 22 April 2005 12:36   |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
You know, I never quite understood that explanation from the manual either
(does it really make sense to anyone?), so I think of it this way:
In the array resulting from Dist(), each element is the straight-line
"distance" from either element [0, 0] or the element just *beyond* each
other corner, whichever is closest.
In these examples I add "*******" for the other hypothetical corner
elements:
IDL> print,dist(4)
0.000000 1.00000 2.00000 1.00000 *******
1.00000 1.41421 2.23607 1.41421
2.00000 2.23607 2.82843 2.23607
1.00000 1.41421 2.23607 1.41421
******* *******
IDL> print,dist(5)
0.000000 1.00000 2.00000 2.00000 1.00000 *******
1.00000 1.41421 2.23607 2.23607 1.41421
2.00000 2.23607 2.82843 2.82843 2.23607
2.00000 2.23607 2.82843 2.82843 2.23607
1.00000 1.41421 2.23607 2.23607 1.41421
******* *******
What's nice is that you can roll the rows and columns around and get a nice
array with distances from the centre point:
IDL> print,Shift(dist(5),2,2)
2.82843 2.23607 2.00000 2.23607 2.82843
2.23607 1.41421 1.00000 1.41421 2.23607
2.00000 1.00000 0.000000 1.00000 2.00000
2.23607 1.41421 1.00000 1.41421 2.23607
2.82843 2.23607 2.00000 2.23607 2.82843
Peace,
--
-Dick
Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
"Haje Korth" <haje.korth@jhuapl.edu> wrote in message
news:d4bgld$il0$1@aplcore.jhuapl.edu...
> Maybe we should start copying from the manual. So here we go:
>
> The DIST function creates an array in which each array element value is
> proportional to its frequency. This array may be used for a variety of
> purposes, including frequency-domain filtering.
>
> This routine is written in the IDL language. Its source code can be found
> in the file dist.pro in the lib subdirectory of the IDL distribution.
>
> (I would post the code too, but it is copyrighted, so you will have to
> look at RSI\IDLxx\lib\dist.pro yourself. Sorry for the inconvenience)
>
> H.
>
>
> "lixiaoyao" <lixiaoyao5880@yahoo.com> wrote in message
> news:1114191092.478578.9120@g14g2000cwa.googlegroups.com...
>> Is there anybody who can explain the dist for me?
>> I know dist(100) generate a 100X100 matrix,but what is the value for
>> it
>> come from? In the help file,they said it is the frequency,but I do not
>> understand.
>> also,what is the purpose for this function?
>> Thanks a lot
>>
>
>
|
|
|