[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

index precision issues

From: Joan Picanyol i Puig
Subject: index precision issues
Date: Tue, 26 Apr 2005 20:14:41 +0200
User-agent: Mutt/1.5.6i


I'm having issues using oversampling for some simulations. In short, I
have two different sample intervals:


I generate drop.t (which is my time variable) with model.dt intervals,
and, I later generate drop.ts, which is the time vector for spatial

drop.t = 0:model.dt:2 * model.r / model.v - model.dt;
drop.ts = drop.t(1):model.dts:drop.t(end);

So drop.ts has a subset of drop.t.

So far so good, the problem is when I'm trying to index vectors using
the ratio between model.dts and model.dt (my oversampling factor). I
believe my problem comes from some weird precision issue, since these
two statements have different results:

mod(25*10^-5/(25*10^-9), 1)
mod(25*10^-7/(25*10^-9), 1)

I used this as an integer test to ensure valid model.dts/model.dt
ratios, but it doesn't work as I thought.  When I try to use selected
samples from my long vector I get:

error: expecting integer index, found 1001.000000
error: in /usr/home/joan/wd/simulacions--mainline--0.6--current/rx_signal.m 
near line 33, column 20:

>>> lsnapshots = ps (:, 1:model.dts / model.dt:__end__)

keyboard: stopped in 
/usr/home/joan/wd/simulacions--mainline--0.6--current/one_drop.m at line 33
debug> disp(size(ps))
        3  1000000
debug> disp(model.dts/model.dt)

What really has me wondering is why some combinations of model.dts and model.dt
work and some not. Are there any other approaches to doing this? How do I
convert to an integer (I'm trying to remain Matlab compatible, and thus avoid


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]