Re: generating symmetric array from function? [message #22775] |
Mon, 11 December 2000 09:15  |
Pavel A. Romashkin
Messages: 531 Registered: November 2000
|
Senior Member |
|
|
When I try Liam's code, X, Y, Z are all FLTARR(41, 41) on my machine. Is
it not 2D on yours? All of the parameters Liam sends to SURFACE are 2D.
That's what REBIN was used for.
Cheers,
Pavel
Nick Bower wrote:
>
> ahh. my mind was stuck on generating a 2D array instead using 1D Z/X/Y
> arrays and letting IDL do the messy stuff .
>
> this solves the plotting problem of course, but just to be pedantic, how do
> you generate the 2D version of Z? Is it possible?n
|
|
|
Re: generating symmetric array from function? [message #22777 is a reply to message #22775] |
Mon, 11 December 2000 08:02   |
Nick Bower
Messages: 43 Registered: June 1999
|
Member |
|
|
ahh. my mind was stuck on generating a 2D array instead using 1D Z/X/Y
arrays and letting IDL do the messy stuff .
this solves the plotting problem of course, but just to be pedantic, how do
you generate the 2D version of Z? Is it possible?
"Liam E. Gumley" wrote:
> Nick Bower wrote:
>>
>> how do I generate symmetric 2D array from a function of one variable?
>>
>> eg. say i want the sinc function in 3 dimensions - how do i generate
>> this symmetrically in both x and y dimensions?
>>
>> presumably, the last step would be a shift by N/2 in both x and y
>> directions to move the origin to the centre of the array, but i'm just
>> not sure what comes before this and how to do it without nested loops
>> over the array elements.
>
> v = findgen(41) * 0.5 - 10.0
> x = rebin(v, 41, 41, /sample)
> y = rebin(reform(v, 1, 41), 41, 41, /sample)
> r = sqrt(x^2 + y^2) + 1.0e-6
> z = sin(r) / r
> surface, z, x, y
>
> Cheers,
> Liam.
> http://cimss.ssec.wisc.edu/~gumley
|
|
|
Re: generating symmetric array from function? [message #22780 is a reply to message #22777] |
Mon, 11 December 2000 07:32   |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
Nick Bower wrote:
>
> how do I generate symmetric 2D array from a function of one variable?
>
> eg. say i want the sinc function in 3 dimensions - how do i generate
> this symmetrically in both x and y dimensions?
>
> presumably, the last step would be a shift by N/2 in both x and y
> directions to move the origin to the centre of the array, but i'm just
> not sure what comes before this and how to do it without nested loops
> over the array elements.
v = findgen(41) * 0.5 - 10.0
x = rebin(v, 41, 41, /sample)
y = rebin(reform(v, 1, 41), 41, 41, /sample)
r = sqrt(x^2 + y^2) + 1.0e-6
z = sin(r) / r
surface, z, x, y
Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
|
|
|
Re: generating symmetric array from function? [message #22913 is a reply to message #22775] |
Mon, 11 December 2000 19:35  |
Nick Bower
Messages: 43 Registered: June 1999
|
Member |
|
|
i'm such a dummy sometimes.
(it was 2am when i posted if that gets me off the hook).
"Pavel A. Romashkin" wrote:
> When I try Liam's code, X, Y, Z are all FLTARR(41, 41) on my machine. Is
> it not 2D on yours? All of the parameters Liam sends to SURFACE are 2D.
> That's what REBIN was used for.
>
> Cheers,
> Pavel
>
> Nick Bower wrote:
>>
>> ahh. my mind was stuck on generating a 2D array instead using 1D Z/X/Y
>> arrays and letting IDL do the messy stuff .
>>
>> this solves the plotting problem of course, but just to be pedantic, how do
>> you generate the 2D version of Z? Is it possible?n
|
|
|