<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Timing code in MATLAB</title>
	<atom:link href="http://blogs.mathworks.com/pick/2008/02/12/timing-code-in-matlab/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick/2008/02/12/timing-code-in-matlab/</link>
	<description>&#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author&#34;&#62;Brett&#60;/a&#62; &#38; &#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author&#34;&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<lastBuildDate>Fri, 10 Feb 2012 16:12:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Arkajit Dey</title>
		<link>http://blogs.mathworks.com/pick/2008/02/12/timing-code-in-matlab/#comment-13938</link>
		<dc:creator>Arkajit Dey</dc:creator>
		<pubDate>Thu, 18 Nov 2010 15:48:28 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/12/timing-code-in-matlab/#comment-13938</guid>
		<description>Thanks for the video. It was very useful. Also, here&#039;s an easier way to time quick actions like Tim&#039;s &#039;dosomething&#039;:

&gt;&gt; tic; dosomething; t = toc

--Arkajit</description>
		<content:encoded><![CDATA[<p>Thanks for the video. It was very useful. Also, here&#8217;s an easier way to time quick actions like Tim&#8217;s &#8216;dosomething&#8217;:</p>
<p>&gt;&gt; tic; dosomething; t = toc</p>
<p>&#8211;Arkajit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/pick/2008/02/12/timing-code-in-matlab/#comment-9539</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 15 Feb 2008 13:42:03 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/12/timing-code-in-matlab/#comment-9539</guid>
		<description>Tim, an excellent suggestion.  I would want to make sure that the time for dosomething &gt;&gt; the rest of the code in loop.  For most applications it would be.

Thanks,
Doug</description>
		<content:encoded><![CDATA[<p>Tim, an excellent suggestion.  I would want to make sure that the time for dosomething >> the rest of the code in loop.  For most applications it would be.</p>
<p>Thanks,<br />
Doug</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Davis</title>
		<link>http://blogs.mathworks.com/pick/2008/02/12/timing-code-in-matlab/#comment-9538</link>
		<dc:creator>Tim Davis</dc:creator>
		<pubDate>Fri, 15 Feb 2008 12:16:55 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/pick/2008/02/12/timing-code-in-matlab/#comment-9538</guid>
		<description>Sometimes you want to time code that runs for a teeny fraction of a second, and

tic ;
dosomething ;
t = toc

is not accurate.   The profiler will also be inaccurate. (You might want to time this teeny fraction of a second becaus you want to use the dosomething function zillions of times inside a larger application).  Here is a trick I like to use



tic ;
t = 0 ;
ntrials = 0 ;
while (t &lt; 1)
    dosomething ;
    ntrials = ntrials + 1 ;
    t = toc ;
end
t = t / ntrials ;



That way, you run &quot;dosomething&quot; enough times to accumulate a whole second, and then you compute the average time per call to dosomething.</description>
		<content:encoded><![CDATA[<p>Sometimes you want to time code that runs for a teeny fraction of a second, and</p>
<p>tic ;<br />
dosomething ;<br />
t = toc</p>
<p>is not accurate.   The profiler will also be inaccurate. (You might want to time this teeny fraction of a second becaus you want to use the dosomething function zillions of times inside a larger application).  Here is a trick I like to use</p>
<p>tic ;<br />
t = 0 ;<br />
ntrials = 0 ;<br />
while (t &lt; 1)<br />
    dosomething ;<br />
    ntrials = ntrials + 1 ;<br />
    t = toc ;<br />
end<br />
t = t / ntrials ;</p>
<p>That way, you run &#8220;dosomething&#8221; enough times to accumulate a whole second, and then you compute the average time per call to dosomething.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

