Re: Lag and A_Correlate/C_Correlate [message #67136] |
Mon, 06 July 2009 18:00 |
Max
Messages: 2 Registered: July 2009
|
Junior Member |
|
|
On Jul 7, 1:51 am, Gianguido <gianguido.cia...@gmail.com> wrote:
>> We would both be very grateful if someone could help clear up these
>> questions: firstly, what does lag measure? Secondly, how does the lag
>> parameter affect the output of the A_CORRELATE and C_CORRELATE
>> functions? Thirdly, what can my friend do to get this to work?
>
> 1) lag is an input not an output. so i am not sure what you mean by
> what does it measure.
> A different way to think of lag is "shift". then these routines
> calculate how "similar" the arrays are if you shift them by 'lag'.
>
> 2) this depends entirely on the input array.
>
> 3) give us more info on the problem she's trying to solve.
>
>
>
>> One idea I've had from searching the internet include creating an
>> array of size n (perhaps F=findgen(n), where n≈90,000) and trying
>> C_CORRELATE with something like "lag = [-F, F]". Is this at least on
>> the right track?
>
> findgen won't give you very interesting results. I would create:
>
> x=findgen(1000)/25.
> g1=exp(-(x-10)^2)
> g2=exp(-(x-30)^2)
>
> plot, x, g1
> oplot, x, g2;as you can see these curves would match perfectly if they
> were *shifted* by 20!
>
> lag=indgen(1000)
>
> cor=c_correlate(g1,g2,lag,/double)
>
> plot, lag/25., cor
> ;this plot shows that g1 and g2 are most correlated if you indeed
> shift them by 20!
>
> Hope this helps.
>
> Ciao,
> G
Thanks very much. Again, sorry I couldn't be more useful in my
description. I've forwarded my friend the link to this thread, so she
should be on eventually to provide some more details to anyone
interested in tackling this. If she isn't, I appreciate your taking
time out to help with such a basic question. If she does come on to
post...hi Catie!
|
|
|
Re: Lag and A_Correlate/C_Correlate [message #67137 is a reply to message #67136] |
Mon, 06 July 2009 16:51  |
cgguido
Messages: 195 Registered: August 2005
|
Senior Member |
|
|
> We would both be very grateful if someone could help clear up these
> questions: firstly, what does lag measure? Secondly, how does the lag
> parameter affect the output of the A_CORRELATE and C_CORRELATE
> functions? Thirdly, what can my friend do to get this to work?
1) lag is an input not an output. so i am not sure what you mean by
what does it measure.
A different way to think of lag is "shift". then these routines
calculate how "similar" the arrays are if you shift them by 'lag'.
2) this depends entirely on the input array.
3) give us more info on the problem she's trying to solve.
>
> One idea I've had from searching the internet include creating an
> array of size n (perhaps F=findgen(n), where n≈90,000) and trying
> C_CORRELATE with something like "lag = [-F, F]". Is this at least on
> the right track?
>
findgen won't give you very interesting results. I would create:
x=findgen(1000)/25.
g1=exp(-(x-10)^2)
g2=exp(-(x-30)^2)
plot, x, g1
oplot, x, g2;as you can see these curves would match perfectly if they
were *shifted* by 20!
lag=indgen(1000)
cor=c_correlate(g1,g2,lag,/double)
plot, lag/25., cor
;this plot shows that g1 and g2 are most correlated if you indeed
shift them by 20!
Hope this helps.
Ciao,
G
|
|
|