Path: news.mathworks.com!not-for-mail
From: "b b" <bogey4@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Bogey
Date: Sun, 26 Oct 2008 18:41:02 +0000 (UTC)
Organization: university of Guelph
Lines: 31
Message-ID: <ge2dju$bjg$1@fred.mathworks.com>
References: <gdvjlp$kij$1@fred.mathworks.com> <gdvoje$gnn$1@fred.mathworks.com> <gdvq28$482$1@fred.mathworks.com> <ge0231$lu$1@fred.mathworks.com> <ge2b76$msj$1@fred.mathworks.com>
Reply-To: "b b" <bogey4@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1225046462 11888 172.30.248.37 (26 Oct 2008 18:41:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 26 Oct 2008 18:41:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 944946
Xref: news.mathworks.com comp.soft-sys.matlab:497320


Hi Roger et al., 

I've got another question for you, and I'm not sure if this can also be done without loops.

I'm trying to sum up the squared Euclidean distance between all combinations of points in two sets (X and muEst), multiplied by a scalar value in ksi.  Again, a point in X is the nth column and a point in muEst is a column in muEst. 

Here's an attempt to write out the equation:
Sum(from n=1 to 4)
   Sum( from i=1 to 4)
     ksi_{ni} ||X_n - muEst_i ||^2
    end
end


and the Corresponding matlab code (which evaluates to tot=186 in this example)
X = [1 2 3 4; 5 4 3 2];
ksi = [ 1 2 2 1; 2 3 3 2; 1 3 5 1; 1 2 2 2];
muEst = [2 3 4 5; 6 5 4 4];
tot = 0;


for n=1: 4,
 for i=1:4,
  tot = tot + ksi(n,i) * sum((X(:,n) - muEst(:,i)).^2);
 end;
end;

Any ideas?
Thanks again,

Bruce