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: NNTP Server
Lines: 23
Message-ID: <ge9ot4$kbi$>
References: <>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Date: Wed, 29 Oct 2008 13:36:37 +0000 (UTC)
X-Notice: Filtered by postfilter v. 0.7.4
User-Agent: Thunderbird (Windows/20080914)
Xref: 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