Re: SHIFT Function [message #79428] |
Tue, 28 February 2012 10:20 |
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  |
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
|
|
|