Re: Inconsistent Mean Calculation [message #30828] |
Tue, 21 May 2002 10:39 |
plmcelwee
Messages: 6 Registered: April 2002
|
Junior Member |
|
|
"Mark Hadfield" <m.hadfield@niwa.co.nz> wrote in message news:<accajn$q28$1@newsreader.mailgate.org>...
> "Phil" <plmcelwee@yahoo.com> wrote in message
> news:a3589d11.0205201557.1a92499f@posting.google.com...
>> I have 5000 frames of video in a NetCDF file, and I want to
>> calculate the average of frame 2557. I have read the video file
>> into both IDL v5.1 and Matlab v6.1. Additionally I have extracted
>> frame 2557 and copied it into Excel. Here are the mean calculations
>> I get for this frame:
>>
>> Matlab: 4092.6805
>> Excel: 4092.6805
>> IDL: 4093.6165
>>
>> Can anyone offer any suggestions as to why the IDL calculation is
>> different?
>
> Matlab uses double-precision real numbers whereas IDL by default uses
> single-precision. Try repeating your IDL calculations using
> double precision (for example, if you are using IDL's TOTAL function,
> set its DOUBLE keyword).
Mark and Ken, thanks for the help! Using double precision I get
IDL: 4092.6804
This is certainly close enough for what I'm doing.
|
|
|
Re: Inconsistent Mean Calculation [message #30836 is a reply to message #30828] |
Mon, 20 May 2002 18:00  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
"Phil" <plmcelwee@yahoo.com> wrote in message
news:a3589d11.0205201557.1a92499f@posting.google.com...
> I have 5000 frames of video in a NetCDF file, and I want to
> calculate the average of frame 2557. I have read the video file
> into both IDL v5.1 and Matlab v6.1. Additionally I have extracted
> frame 2557 and copied it into Excel. Here are the mean calculations
> I get for this frame:
>
> Matlab: 4092.6805
> Excel: 4092.6805
> IDL: 4093.6165
>
> Can anyone offer any suggestions as to why the IDL calculation is
> different?
Matlab uses double-precision real numbers whereas IDL by default uses
single-precision. Try repeating your IDL calculations using
double precision (for example, if you are using IDL's TOTAL function,
set its DOUBLE keyword).
--
Mark Hadfield "Ka puwaha et tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
>
|
|
|
Re: Inconsistent Mean Calculation [message #30837 is a reply to message #30836] |
Mon, 20 May 2002 18:59  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article <a3589d11.0205201557.1a92499f@posting.google.com>,
plmcelwee@yahoo.com (Phil) wrote:
> I have 5000 frames of video in a NetCDF file, and I want to calculate
> the average of frame 2557. I have read the video file into both IDL
> v5.1 and
> Matlab v6.1. Additionally I have extracted frame 2557 and copied it
> into Excel. Here are the mean calculations I get for this frame:
>
> Matlab: 4092.6805
> Excel: 4092.6805
> IDL: 4093.6165
>
> Can anyone offer any suggestions as to why the IDL calculation is
> different? Maybe there is a bug in IDL 5.1? Yeah I know it's a
> really old version. :)
Excel is doing the calculation in double precision; Matlab probably
likewise. Try TOTAL(image, /DOUBLE)/n or MOMENTS(image, /DOUBLE) in IDL
and let us know what you get.
5.1 is really old? Oh, maybe it's me that's really old.
Ken
|
|
|