Path: news.mathworks.com!not-for-mail
From: "Natalie Sin Hwee " <sin.ng09@imperial.ac.uk>
Newsgroups: comp.soft-sys.matlab
Subject: Re: finding distances that satisfy the equation ? (confused :'( , please help)
Date: Mon, 29 Mar 2010 09:56:04 +0000 (UTC)
Organization: Imperial College
Lines: 30
Message-ID: <hoptfk$7du$1@fred.mathworks.com>
References: <hoo666$8u3$1@fred.mathworks.com> <hoo9it$r4p$1@fred.mathworks.com>
Reply-To: "Natalie Sin Hwee " <sin.ng09@imperial.ac.uk>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1269856564 7614 172.30.248.35 (29 Mar 2010 09:56:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Mar 2010 09:56:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2069448
Xref: news.mathworks.com comp.soft-sys.matlab:621415

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hoo9it$r4p$1@fred.mathworks.com>...
> "Natalie Sin Hwee " <sin.ng09@imperial.ac.uk> wrote in message <hoo666$8u3$1@fred.mathworks.com>...
> > ........
> > for node=1:a; 
> >     for u=1:a; 
> >         theta(node,u)=atan2(imag((x(1,u)-x(1,node))+[(y(1,u)-y(1,node))*i]),...
> >                         real((x(1,u)-x(1,node))+[(y(1,u)-y(1,node))*i]));
> >     end
> > end
> > 
> > [thetasort,R]=sort(theta,1); % increasing angles downward (column)
> > 
> > sect1=((0<thetasort) & (thetasort<(0.25*pi)));
> ----------
>   This looks like a very awkward way to compute your angles.  Why take the trouble to create complex-valued quantities only to convert them back to real values again?  Why not just say this:
> 
>  theta(node,u)=atan2(y(u)-y(node),x(u)-x(node));
> 
>   With either method you will be obtaining angles measured counterclockwise from the x-axis to the directed line between each pair of points and which range from -pi to +pi.  You will be selecting only those between 0 and +pi/4, and in particular rejecting those between -pi/4 and 0.  In the cases where node equals u along the diagonal your results will be meaningless.  Is this what you want?
> 
>   Why do you sort the angles before subjecting them to your range tests?  What you will get is a series of falses, then trues, and finally falses.  As your code stands there is no way to associate this with the original data in x and y.
> 
> Roger Stafford

hiya, 

basically i used a more 'complex' method because im working from 0-pi and 0 - (-pi) hence the atan2. im nore sure why im using the real and imaginary. apparently it will work in 3d (through my previous quetisons on the forum) - which i will later need to make my model into 3d !! ^^ 

thanks 
natalie