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

Home » Public Forums » archive » Re: Help me aviod a FOR loop!?!?
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: Help me aviod a FOR loop!?!? [message #30436 is a reply to message #30411] Wed, 24 April 2002 02:01 Go to previous messageGo to previous message
Malcolm Walters is currently offline  Malcolm Walters
Messages: 8
Registered: October 2001
Junior Member
"Sean Davis" <sdavis@nis.lanl.gov> wrote in message
news:Pine.LNX.4.33.0204231006000.1744-100000@vglass.lanl.gov ...
> I don't know if this is possible. I have 4 coeffecients,
> a,c,d,cd, that are each 3191-long arrays, and I would like to construct
> 3191, waveforms (of length 128) from these coefeccients.
>
> Here's what I'm trying to do:
>
> x = FINDGEN(128)
> yfit = FLTARR(128,3191)
>
> yfit = (a/cd)*( exp(-1.*c*x)-exp(-1.*d*x) )
>
> In the end, I would like yfit to be an array of (128,3191) or (3191,128).
>
> I can't figure out how to do this without using a FOR loop. Is there any
> hope for doing this without a FOR loop?

I think this calls for use of rebin and matrix multiplication.
The rebin is required to turn 'a' and 'cd' into arrays the same shape as the
result of the matrix multiplications.

so...
a=randomn(systime(/seconds),3191)
c=randomu(systime(/seconds),3191)
d=randomu(systime(/seconds),3191)
cd=randomn(systime(/seconds),3191)
x=findgen(128)
yfit = (rebin(a,3191,128,/sample)/rebin(cd,3191,128,/sample))*(
exp(-c#x)-exp(-d#x) )

Malcolm
>
> THANKS!!!!!!
>
> Sean
>
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: signed character
Next Topic: Re: How to make a ribbon plot

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

Current Time: Thu Oct 09 07:47:58 PDT 2025

Total time taken to generate the page: 0.71992 seconds