Path: news.mathworks.com!not-for-mail
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$1@newscl01ah.mathworks.com>
References: <j3e342$dbb$1@newscl01ah.mathworks.com> <j3eb5j$52j$1@newscl01ah.mathworks.com> <j3eimp$op4$1@newscl01ah.mathworks.com> <j3elq6$3jr$1@newscl01ah.mathworks.com> <j3en77$7br$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1314580090 11597 172.30.248.45 (29 Aug 2011 01:08:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Aug 2011 01:08:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:741524

"Juliette Salexa" wrote in message <j3en77$7br$1@newscl01ah.mathworks.com>...
> .........
> 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