From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Basic Matlab help
Date: Wed, 21 Apr 2010 19:23:06 -0500
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <hqo50f$7vi$>
References: <hqo2po$h11$>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 22 Apr 2010 00:24:48 +0000 (UTC)
Injection-Info:; posting-host="+vXiRB9knG1OYC0iOMVdug";
	logging-data="8178"; mail-complaints-to="";	posting-account="U2FsdGVkX1/o0uYhcUxKUfL6Z1mwSFNO"
User-Agent: Thunderbird (Windows/20100228)
In-Reply-To: <HIDDEN>
Cancel-Lock: sha1:qZHVl1nFHnjPRM5sgg7dHs6jtsc=
Xref: comp.soft-sys.matlab:628712

Ashley Wright wrote:
> I'm really rusty with MATLAB and need some assistance.  I'm trying to 
> write a code to take r = sqrt((D-y)^2+x^2) and its not working out the 
> way I would like.  x and y are values from 1 to 1000. I'd like MATLAB to 
> calculate r1 using the equation above for each combination of values in 
> the matrix.  For example:
> r(1,1) would be sqrt((D-1)^2+1^2), r(1,2) would be sqrt((D-1)^2+2^2), 
> ..., r(x,y) = sqrt((D-y)^2+x^2), etc.  How do I go about doing that?  I 
> can do it with loops, but that is very inefficient.  Thanks for the help.

Or, just for grins compared to others...