Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!newsfeed00.sul.t-online.de!t-online.de!news.k-dsl.de!aioe.org!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: computing sum of squared deviations without a for-loop
Date: Wed, 29 Oct 2008 08:32:23 -0500
Organization: Aioe.org NNTP Server
Lines: 23
Message-ID: <ge9ot4$kbi$1@aioe.org>
References: <be6e1c36-aa98-427b-b1d6-8ac03cc0f4ef@d45g2000hsc.googlegroups.com>
NNTP-Posting-Host: 4Dl2BcATZOPyxdCIXQxhlA.user.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
NNTP-Posting-Date: Wed, 29 Oct 2008 13:36:37 +0000 (UTC)
X-Notice: Filtered by postfilter v. 0.7.4
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
Xref: news.mathworks.com comp.soft-sys.matlab:497821

Lee wrote:
...
> S=[];
>       for i=1:N
>           x=G(:,i)-g_bar;
>           S=S+(x*x');
> end
> 
> where the inputs are:
> G is a m by N matrix.
> G(:,i) is the ith column of G,
> g_bar is a m by 1 vector.
> 
> If you write out this for-loop mathematically, you can see S is simply
> the sum of squared deviations.  But is there a way to compute it from
> the inputs without such a for-loop?

doc std

Specifically, look at the optional arguments--don't they allow the 
requested?

--