Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Contracting Matrices
Date: Sat, 27 Dec 2008 22:27:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <gj6a3l$nt3$1@fred.mathworks.com>
References: <gj5ksv$1mq$1@fred.mathworks.com> <gj5o9m$n2n$1@fred.mathworks.com> <gj5tat$jb2$1@fred.mathworks.com> <gj65bp$dhc$1@fred.mathworks.com> <gj66sh$dfj$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1230416821 24483 172.30.248.37 (27 Dec 2008 22:27:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 27 Dec 2008 22:27:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:508926


"Philosophaie" <ertlejack@sbcglobal.net> wrote in message <gj66sh$dfj$1@fred.mathworks.com>...
> ......
> My results were:
> size(Riemann) --> [4 4 4 4]
> size(temp) --> [4 4 16]
> size(sum(temp(:,:,1:4+1:4*4,1),3)) --> [4 1]
> size(Ricci) --> [4 1]
> 
> What does the "3" do in the sum command.  Where am I going wrong?

  If my understanding is correct, 'reshape' of a [4 4 4 4] array should have given you [4 4 16 1], not [4 4 16].

  What did you get for size(temp(:,:,1:4+1:4*4,1))?  It should have been [4 4 4 1] or with the above result [4 4 4].  Given the above [4 4 16] result, the expression temp(:,:,1:4+1:4*4,1) should have given an error.  Did it?

  In any case, the 'sum' action should have been along the third dimension and left you with a size of [4 4 1] or at worst [4 4].  It looks as though your 'sum' paid no attention to the '3' parameter, which directs summation to that third dimension.  There should also have been an error indicated for the presence of the parameter '3' if your 'sum' wasn't recognizing a second parameter.

  I have no way of accounting for your results.  What version of matlab did you use?

Roger Stafford