<?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/videos/2008/02/12/timing-code-in-matlab/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/videos/2008/02/12/timing-code-in-matlab/</link>
	<description>Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.</description>
	<lastBuildDate>Mon, 06 Feb 2012 18:06:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Doug</title>
		<link>http://blogs.mathworks.com/videos/2008/02/12/timing-code-in-matlab/#comment-821</link>
		<dc:creator>Doug</dc:creator>
		<pubDate>Fri, 15 Feb 2008 13:42:03 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/02/12/timing-code-in-matlab/#comment-821</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/videos/2008/02/12/timing-code-in-matlab/#comment-820</link>
		<dc:creator>Tim Davis</dc:creator>
		<pubDate>Fri, 15 Feb 2008 12:16:55 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/videos/2008/02/12/timing-code-in-matlab/#comment-820</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>

