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

Home » Public Forums » archive » Re: CORRELATE where is the problem?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: CORRELATE where is the problem? [message #65471] Sun, 08 March 2009 12:39 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
xiao writes:

> Hi~ everyone. I have a simple question here. I have two arrays and I
> calculated the correlation between them. The result is 0.49. But when
> I use the equation to calculate the correlation. The result is 0.99.
> And I can see from the plot that they are actually highly correlated.
> Why is that? THX
>
> openr,1,'data.txt'
> data=fltarr(2,1227)
> readf,1,data
>
> temp=data(1,*)
> oo=data(0,*)
> ;print,temp(0)
>
> temp=reform(temp)
> oo=reform(oo)
>
> corr=CORRELATE(oo,temp)
> print,corr
> rr=LINFIT(temp,oo)
> print,rr
> plot,psym=2,temp,oo

Which equation are you talking about? My guess is
you have constructed the equation incorrectly.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: CORRELATE where is the problem? [message #65569 is a reply to message #65471] Sun, 08 March 2009 13:35 Go to previous message
xiao zhang is currently offline  xiao zhang
Messages: 81
Registered: June 2008
Member
I used the equation in this link:

http://www.jerrydallal.com/LHSP/corr.htm

but the result is different from IDL :(

Xiao





On Mar 8, 2:39 pm, David Fanning <n...@dfanning.com> wrote:
> xiao writes:
>> Hi~ everyone. I have a simple question here. I have two arrays and I
>> calculated the correlation between them.  The result is 0.49. But when
>> I use the equation to calculate the correlation. The result is 0.99.
>> And I can see from the plot that they are actually highly correlated.
>> Why is that?  THX
>
>> openr,1,'data.txt'
>> data=fltarr(2,1227)
>> readf,1,data
>
>> temp=data(1,*)
>> oo=data(0,*)
>> ;print,temp(0)
>
>> temp=reform(temp)
>> oo=reform(oo)
>
>> corr=CORRELATE(oo,temp)
>> print,corr
>> rr=LINFIT(temp,oo)
>> print,rr
>> plot,psym=2,temp,oo
>
> Which equation are you talking about? My guess is
> you have constructed the equation incorrectly.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: about ENVI_display_bands
Next Topic: Black Widgets Draw Window in d_plot2d and d_gridding

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

Current Time: Wed Oct 08 11:36:47 PDT 2025

Total time taken to generate the page: 0.00516 seconds