Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Calculting incomplete convolution
Date: Thu, 22 Jan 2009 23:09:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 26
Message-ID: <glauae$9pi$1@fred.mathworks.com>
References: <glarf5$nb7$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1232665742 10034 172.30.248.35 (22 Jan 2009 23:09:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 22 Jan 2009 23:09:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:513293

"Stefan Hovens" <stefanhovens@gmail.com> wrote in message <glarf5$nb7$1@fred.mathworks.com>...
> I want to write the following program in Matlab, because excel can cope anymore
> 
> Given:
> Matrix A consisting of 20 columns and 2000 rows which will not change
> Matrix B consisting of 200 columns and one row which will not change
> Matrix C consisting of 1 colmn and 2000 rows which will change
> 
> Created during program :
> Matrix D consisting of 1 column of 2000 rows which will change
> 
> Look up the element x (1 to 2000) in matrix A and remeber the row as y and the colmn as z
> Multiply the element in colmn y in Matrix B with the element in row z in Matrix C and add it to a new Matrix D in row x. When the element x is present more than once in matrix A than add it to the value that is already created in Matrix D.
> For x<1 add the value for Matrix D in row of x=1
> For x>2000 add the value for matrix D in row of x=2000
> 
> Compare values of Matrix C with those of Matrix D, when the difference is less then p store Matrix D, else store Matrix D as Matrix C and start over again.
> 
> This is a problem of an incomplete convolution. It can be written down much shorter, but I'm not able to do that YET.

  Your wordage would imply that there are as many rows in A as there are columns in B, and as many columns in A as there are rows in C, but neither fact is true as you have described the sizes of A, B, and C.  Assuming this is somehow repaired, it looks as though you have something that 'accumarray' could handle quite easily in computing D.

  A and D are not of the same sizes.  What do you mean by their "difference" being less than p?

Roger Stafford