```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:00:06 +0000 (UTC)
Organization: university of Guelph
Lines: 28
Message-ID: <ge2b76\$msj\$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>
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 1225044006 23443 172.30.248.37 (26 Oct 2008 18:00:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 26 Oct 2008 18:00:06 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:497318

Brilliant! The first line ( tot = X*ksi*Y; ) gave me the correct answer.  I'm glad to now know an elegant and straight forward solution to this.  As for computational speed, it seems that the equation that you suggested is faster:

tot = zeros(2,3);
tic;
for n = 1: 4;
for i = 1: 4;
tot = tot+ ksi(n,i)*X(:,n)*Y(i,:);
end;
end;
toc
Elapsed time is 0.000118 seconds.

tic; X*ksi*Y; toc
Elapsed time is 0.000032 seconds.

Thanks again!
Bruce

>   In that case try this:
>
> tot = X*ksi*Y;
>
> It should give the correct answer.  Whether it is faster you will have to determine for yourself.  You can experiment with parentheses: (X*ksi)*Y as compared with X*(ksi*Y).
>
> Roger Stafford
>

```