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

Home » Public Forums » archive » Re: SHIFT Function
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: SHIFT Function [message #79428] Tue, 28 February 2012 10:20
zolile mtumela is currently offline  zolile mtumela
Messages: 50
Registered: September 2011
Member
On Feb 28, 8:00 pm, Yngvar Larsen <larsen.yng...@gmail.com> wrote:
> On Feb 28, 8:05 am, zolile mtumela <zolilemtum...@gmail.com> wrote:
>
>> I  got centre frequency(freq_centre=2.35e-3),
>> From the data,  period (T=20), number of elements( Ny=360), data for
>> 2hours.
>> freq_centre = 2.35e-3
>> Freqc=(freq_centre/(1/(Ny*T)))
>> print,freqc
> [...]
>> On calculating Freqc , I supposed to get around 17 but on the program
>> its print infinite ,
>
> My guess is that you are doing integer division in the denominator.
>
> IDL> T = 20
> IDL> Ny = 360
> IDL> print, 1/(Ny*T)
>        0
> IDL> freq_centre = 2.35e-3
> IDL> print, freq_centre/(1/(Ny*T))
>           Inf
> % Program caused arithmetic error: Floating divide by 0
> IDL> print, freq_centre/(1./(Ny*T))
>       16.9200
>
> --
> Yngvar

thank you so much, Its working as you showed!
Re: SHIFT Function [message #79431 is a reply to message #79428] Tue, 28 February 2012 10:00 Go to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Feb 28, 8:05 am, zolile mtumela <zolilemtum...@gmail.com> wrote:
> I  got centre frequency(freq_centre=2.35e-3),
> From the data,  period (T=20), number of elements( Ny=360), data for
> 2hours.
> freq_centre = 2.35e-3
> Freqc=(freq_centre/(1/(Ny*T)))
> print,freqc
[...]
> On calculating Freqc , I supposed to get around 17 but on the program
> its print infinite ,

My guess is that you are doing integer division in the denominator.

IDL> T = 20
IDL> Ny = 360
IDL> print, 1/(Ny*T)
0
IDL> freq_centre = 2.35e-3
IDL> print, freq_centre/(1/(Ny*T))
Inf
% Program caused arithmetic error: Floating divide by 0
IDL> print, freq_centre/(1./(Ny*T))
16.9200

--
Yngvar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Integer least square
Next Topic: Last Days of Coyote Book Sale!

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

Current Time: Wed Oct 08 15:17:07 PDT 2025

Total time taken to generate the page: 0.00436 seconds