From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: matlab alternative to mtimesx for this problem ?
Date: Mon, 29 Aug 2011 01:08:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 13
Message-ID: <j3eopq$bad$>
References: <j3e342$dbb$> <j3eb5j$52j$> <j3eimp$op4$> <j3elq6$3jr$> <j3en77$7br$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1314580090 11597 (29 Aug 2011 01:08:10 GMT)
NNTP-Posting-Date: Mon, 29 Aug 2011 01:08:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:741524

"Juliette Salexa" wrote in message <j3en77$7br$>...
> .........
> So would I be right in thinking that the best way to do this then by using a forloop over t rather than a possible 'vectorized' version (considering that I only have 64GB of RAM and will certainly need more if I'm using one of the above techniques) ?
- - - - - - - - - -
  Your planned use of 'mtimesx' suggests that your integrand may be separable into two factors, one a function of w and the other a function of t.  If so, as Bruno pointed out, the t-factor can be factored out of the integral and only a single integration need be performed.

  Otherwise I would suggest that rather than using ten thousand points in the range of w you consider a much smaller number and use one of the higher order integration methods to be found in the file exchange.  As for the ten thousand points in t, you might consider reducing their number also and use interpolation to fill in the gaps after integration is performed if needed.  This of course assumes that your integrand is a continuous function with continuous derivatives.

  Also if you are able to express the integrand as a function of w and t in an m-file or anonymous function, you might consider using one of matlab's quadrature functions, 'quad', etc.  These will attempt to optimize the number of steps needed to achieve your desired accuracy rather than using a fixed number.

  Finally, don't overlook the possibility that your integral may have an analytic solution which the symbolic toolbox could find.  That could greatly simplify the problem for you.

Roger Stafford