help-octave
[Top][All Lists]
Advanced

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

iterative comparison


From: E2
Subject: iterative comparison
Date: Tue, 10 Jun 2003 12:42:24 -0400
User-agent: Mutt/1.4.1i

Howdy all, 
I've got an array of positions pos = [x1,y1;x2,y2;....] and
an array of obstacles obs = [x1,y1;x2,y2;...] and I'd like to
know the positions that are within some threshold of an obstacle.

<background>
the positon array describes the path of a robot, and the obstacle
array describes obstacle positions.  I want to know when the robot
impacted with an obstacle (i.e. came within some threshold) so
I can calculate a reward for reinforcement learning.
</background>

I know I could do it with for loops basically doing:

for i 
for j
        if(norm(pos(i,:) - obs(j,:)) < thresh)
                impacts ++;



But I've been told that octave and matlab have lots of overhead
associated with for/while loops, so I was wondering if anyone had
some hints for a faster solution.  

-- 
--E2



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

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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