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

Home » Public Forums » archive » summation and 3d plot
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: summation and 3d plot [message #68498 is a reply to message #68421] Fri, 30 October 2009 10:09 Go to previous messageGo to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Oct 30, 12:12 am, pp <pp.pente...@gmail.com> wrote:
> On Oct 30, 1:55 am, Jeremy Bailin <astroco...@gmail.com> wrote:
>
>
>
>
>
>> Can't you replace the for loops with:
>
>> nnx = n_elements(nx)
>> nny = n_elements(ny)
>> nN = n_elements(N)
>> x0 = rebin(reform(x0,nnx,1,1),nnx,nny,nN)
>> y0 = rebin(reform(y0,1,nny,1),nnx,nny,nN)
>> phi = rebin(reform(phi,1,1,nN),nnx,nny,nN)
>> r0 = sqrt(x0^2 + y0^2)
>> x = abs(x0*cos(phi) + y0*sin(phi))
>> y = -x0*sin(phi) + y0*cos(phi)
>> h = 50.-y
>> deffs = sqrt(d^2 + 2./mu*tan(a/2.*!pi/180.))
>> S = deffs^2 * sin(atan(x/h))^3 / (4.*h)^2 * 100.
>> deffr = d + alog(2.)/mu*tan(a/2.*!pi/180.)
>> R = sqrt((h/f*ri)^2 + (deffr*(h+f)/f)^2)
>
>> -Jeremy.
>
> Yes, that is about what I was hinting at when I said it could be done
> without loops. But given the initial question, I thought that jumping
> directly to this level might make it difficult to understand.

Oddly enough, I think this version is much more readable than the
looped version... I think that's a sign of doing too mcuh IDL
programming! ;-)

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problems with dialog_pickfile and JavaBridge
Next Topic: weird contour lines

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

Current Time: Sat Oct 11 09:44:43 PDT 2025

Total time taken to generate the page: 0.87672 seconds