<?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: Computational Geometry in MATLAB R2009a, Part II</title>
	<atom:link href="http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/</link>
	<description>Loren Shure works on design of the MATLAB language at MathWorks. She writes here about once a week on MATLAB programming and related topics.</description>
	<lastBuildDate>Thu, 09 Feb 2012 04:19:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Damian Sheehy</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-32475</link>
		<dc:creator>Damian Sheehy</dc:creator>
		<pubDate>Fri, 02 Sep 2011 13:43:42 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-32475</guid>
		<description>Darin,

This issue is discussed in the documentation:
http://www.mathworks.com/help/techdoc/math/bspqjle-1.html

When you call DELAUNAY with a set of points that contain duplicates you will discover some data points are not referenced by the triangulation. If you were to use that triangulation to develop an algorithm, this could cause problems. 

Adding a method to DelaunayTri to provide information about duplicates may seem like a good idea at first. But in terms of interface design we are really concerned about the separation of responsibility. DelaunayTri is for triangulating data and querying that triangulation. Eliminating duplicates is the responsibility of another function. Besides, you would still need to intervene to get what you want. For example, when eliminating duplicates you may wish to average the corresponding Z values.

As far as updating your Z goes, you may also wish to take a look at this section on interpolation:
http://www.mathworks.com/help/techdoc/math/bsou4rj-1.html#bsphz74-1</description>
		<content:encoded><![CDATA[<p>Darin,</p>
<p>This issue is discussed in the documentation:<br />
<a href="http://www.mathworks.com/help/techdoc/math/bspqjle-1.html" rel="nofollow">http://www.mathworks.com/help/techdoc/math/bspqjle-1.html</a></p>
<p>When you call DELAUNAY with a set of points that contain duplicates you will discover some data points are not referenced by the triangulation. If you were to use that triangulation to develop an algorithm, this could cause problems. </p>
<p>Adding a method to DelaunayTri to provide information about duplicates may seem like a good idea at first. But in terms of interface design we are really concerned about the separation of responsibility. DelaunayTri is for triangulating data and querying that triangulation. Eliminating duplicates is the responsibility of another function. Besides, you would still need to intervene to get what you want. For example, when eliminating duplicates you may wish to average the corresponding Z values.</p>
<p>As far as updating your Z goes, you may also wish to take a look at this section on interpolation:<br />
<a href="http://www.mathworks.com/help/techdoc/math/bsou4rj-1.html#bsphz74-1" rel="nofollow">http://www.mathworks.com/help/techdoc/math/bsou4rj-1.html#bsphz74-1</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darin</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-32473</link>
		<dc:creator>Darin</dc:creator>
		<pubDate>Thu, 01 Sep 2011 22:18:07 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-32473</guid>
		<description>Poblem associating X/Y/Z poitns after triangulating in XY via DelaunayTri.  If the X/Y contain duplicate points they are removed.  You no longer know which Z goes with which XY, or what DT.X goes with the input XY.  Is DelaunayTri&#039;s criteria for removal EXACT equality of X and Y?  Is there an easier way than pre-screening to remove matches? (Seems to defeat some of the improvment over delaunay.)  How about adding optional output parameters to descramble this?

&lt;pre&gt;
[DT,ind] = DelaunayTri(X,Y);  %??
&lt;/pre&gt;

where ind is a list of the DT.X output index receiving each XY input point (for use in accumarray)?</description>
		<content:encoded><![CDATA[<p>Poblem associating X/Y/Z poitns after triangulating in XY via DelaunayTri.  If the X/Y contain duplicate points they are removed.  You no longer know which Z goes with which XY, or what DT.X goes with the input XY.  Is DelaunayTri&#8217;s criteria for removal EXACT equality of X and Y?  Is there an easier way than pre-screening to remove matches? (Seems to defeat some of the improvment over delaunay.)  How about adding optional output parameters to descramble this?</p>
<pre>
[DT,ind] = DelaunayTri(X,Y);  %??
</pre>
<p>where ind is a list of the DT.X output index receiving each XY input point (for use in accumarray)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damian Sheehy</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31798</link>
		<dc:creator>Damian Sheehy</dc:creator>
		<pubDate>Thu, 28 Oct 2010 16:01:49 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31798</guid>
		<description>Darin,

This is a good question on a usecase I can see has practical relevance.
When we design a feature like this we try to strike a balance between functional ease-of-use 
and complexity associated with the more advanced bells and whistles.

Your usecase falls into the advanced category and while TriScatteredInterp doesn&#039;t readily provide a &quot;canned&quot; solution you can do this with a couple of extra steps.


We will reuse the above example that illustrated boundary slivers and create a DelaunayTri from the data as before.

&lt;pre&gt;
t= 0.4*pi:0.02:0.6*pi;
x1 = cos(t)&#039;;
y1 = sin(t)&#039;-1.02;
x2 = x1;
y2 = y1*(-1);
x3 = linspace(-0.3,0.3,16)&#039;;
y3 = zeros(16,1);
x = [x1;x2;x3];
y = [y1;y2;y3];
dt = DelaunayTri(x,y);
&lt;/pre&gt;


We can use the aspect ratio (AR) of the triangle as a rejection criterion; the AR being defined as the ratio of the incircle radius to circumcircle radius.
I did some experimenting and found 0.01 was a good threshold for this example.

&lt;pre&gt;
[~, Ric] = dt.incenters();
[~, Rcc] = dt.circumcenters();
AR = Ric./Rcc;
&lt;/pre&gt;


Now find the indices of the admissible triangles and visually inspect.

&lt;pre&gt;
Tadmissible = find(AR &gt; 0.01);
trisurf(dt(Tadmissible  ,:),x,y,zeros(size(x)))
&lt;/pre&gt;


Assign NaNs to the points that are not within our region of interest.
We will use the same query data as before and use the pointLocation method provided by DelaunayTri to find the triangles enclosing the points.

&lt;pre&gt;
[xi,yi] = meshgrid(-0.3:.02:0.3, -0.0688:0.01:0.0688);
gridsize = size(xi);
xi = xi(:);
yi = yi(:);
% Initialize the corresponding values using NaNs and later replace the valid entries.
zi = NaN(size(xi,1),1);
Tenclosing = dt.pointLocation(xi,yi);
validxiyi = ismember(Tenclosing,Tadmissible );
&lt;/pre&gt;

You can reuse the DelaunayTri by passing it to TriScatteredInterp - don&#039;t waste anything you can reuse!

&lt;pre&gt;
z = x.^2 + y.^2;
F = TriScatteredInterp(dt,z);
%
% Evaluate the interpolant at the valid query locations
zi(validxiyi) = F(xi(validxiyi), yi(validxiyi))
% Reshape the data so we can call mesh
xi = reshape(xi,gridsize );
yi = reshape(yi,gridsize );
zi = reshape(zi,gridsize );
mesh(xi,yi,zi)
xlabel(&#039;Interpolated surface&#039;, &#039;fontweight&#039;,&#039;b&#039;);
&lt;/pre&gt;

If linear interpolation suffices, you could use DelaunayTri to perform the interpolation.
The pointLocation method returns the Barycentric coordinates bc which are used to weight the values at each vertex of the enclosing triangle.

&lt;pre&gt;
dt = DelaunayTri(x,y);
z = x.^2 + y.^2;
[ti bc] = dt.pointLocation(xi,yi);
T = dt.Triangulation;
zi = z(T(ti,1)).*bc(:,1)+z(T(ti,2)).*bc(:,2)+z(T(ti,3)).*bc(:,3)
&lt;/pre&gt;

The user documentation for Scattered Data Interpolation has been revised recently and may help clarify the latter approach.  
http://www.mathworks.com/help/techdoc/math/bsou4rj-1.html</description>
		<content:encoded><![CDATA[<p>Darin,</p>
<p>This is a good question on a usecase I can see has practical relevance.<br />
When we design a feature like this we try to strike a balance between functional ease-of-use<br />
and complexity associated with the more advanced bells and whistles.</p>
<p>Your usecase falls into the advanced category and while TriScatteredInterp doesn&#8217;t readily provide a &#8220;canned&#8221; solution you can do this with a couple of extra steps.</p>
<p>We will reuse the above example that illustrated boundary slivers and create a DelaunayTri from the data as before.</p>
<pre>
t= 0.4*pi:0.02:0.6*pi;
x1 = cos(t)';
y1 = sin(t)'-1.02;
x2 = x1;
y2 = y1*(-1);
x3 = linspace(-0.3,0.3,16)';
y3 = zeros(16,1);
x = [x1;x2;x3];
y = [y1;y2;y3];
dt = DelaunayTri(x,y);
</pre>
<p>We can use the aspect ratio (AR) of the triangle as a rejection criterion; the AR being defined as the ratio of the incircle radius to circumcircle radius.<br />
I did some experimenting and found 0.01 was a good threshold for this example.</p>
<pre>
[~, Ric] = dt.incenters();
[~, Rcc] = dt.circumcenters();
AR = Ric./Rcc;
</pre>
<p>Now find the indices of the admissible triangles and visually inspect.</p>
<pre>
Tadmissible = find(AR &gt; 0.01);
trisurf(dt(Tadmissible  ,:),x,y,zeros(size(x)))
</pre>
<p>Assign NaNs to the points that are not within our region of interest.<br />
We will use the same query data as before and use the pointLocation method provided by DelaunayTri to find the triangles enclosing the points.</p>
<pre>
[xi,yi] = meshgrid(-0.3:.02:0.3, -0.0688:0.01:0.0688);
gridsize = size(xi);
xi = xi(:);
yi = yi(:);
% Initialize the corresponding values using NaNs and later replace the valid entries.
zi = NaN(size(xi,1),1);
Tenclosing = dt.pointLocation(xi,yi);
validxiyi = ismember(Tenclosing,Tadmissible );
</pre>
<p>You can reuse the DelaunayTri by passing it to TriScatteredInterp &#8211; don&#8217;t waste anything you can reuse!</p>
<pre>
z = x.^2 + y.^2;
F = TriScatteredInterp(dt,z);
%
% Evaluate the interpolant at the valid query locations
zi(validxiyi) = F(xi(validxiyi), yi(validxiyi))
% Reshape the data so we can call mesh
xi = reshape(xi,gridsize );
yi = reshape(yi,gridsize );
zi = reshape(zi,gridsize );
mesh(xi,yi,zi)
xlabel('Interpolated surface', 'fontweight','b');
</pre>
<p>If linear interpolation suffices, you could use DelaunayTri to perform the interpolation.<br />
The pointLocation method returns the Barycentric coordinates bc which are used to weight the values at each vertex of the enclosing triangle.</p>
<pre>
dt = DelaunayTri(x,y);
z = x.^2 + y.^2;
[ti bc] = dt.pointLocation(xi,yi);
T = dt.Triangulation;
zi = z(T(ti,1)).*bc(:,1)+z(T(ti,2)).*bc(:,2)+z(T(ti,3)).*bc(:,3)
</pre>
<p>The user documentation for Scattered Data Interpolation has been revised recently and may help clarify the latter approach.<br />
<a href="http://www.mathworks.com/help/techdoc/math/bsou4rj-1.html" rel="nofollow">http://www.mathworks.com/help/techdoc/math/bsou4rj-1.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darin Williams</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31794</link>
		<dc:creator>Darin Williams</dc:creator>
		<pubDate>Thu, 28 Oct 2010 02:43:29 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31794</guid>
		<description>Your blog makes some great points about the perils of triangulated interpolation.  Suppose that &quot;suspect&quot; boundary triangles are already identified, and one would like to treat them as though they were outside the hull for interpolation, returning points withing them as nans.  How could this be done with triscatteredInterp?

Note thaat this, effectively imposes a non-convex boundary on the interpolation.</description>
		<content:encoded><![CDATA[<p>Your blog makes some great points about the perils of triangulated interpolation.  Suppose that &#8220;suspect&#8221; boundary triangles are already identified, and one would like to treat them as though they were outside the hull for interpolation, returning points withing them as nans.  How could this be done with triscatteredInterp?</p>
<p>Note thaat this, effectively imposes a non-convex boundary on the interpolation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damian Sheehy</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31584</link>
		<dc:creator>Damian Sheehy</dc:creator>
		<pubDate>Fri, 13 Aug 2010 13:44:18 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31584</guid>
		<description>Mike,

	In item #21 above, I outlined the approach to handling duplicate data points in the scenario where the interpolant is to be reused with different values V. This suggests removing the duplicates prior to performing the interpolation and the steps to do this are provided.

TriScatteredInterp allows X and V to behave independently of each other. This flexibility allows the underlying triangulation to be reused when V is changed and this is very desirable because a retriangulation of X incurs an overhead. In your duplicate point scenario X and V are not strictly independent of each other and the design cannot handle both situations faithfully.

TriScatteredInterp cannot and should not remember which points were merged when the interpolant was created, 
because when the interpolant is subsequently edited we cannot assume intent.

The user may wish to replace V and retain the same locations X, OR the user may wish to replace V and then replace X with a completely different set of locations.
A more conservative design would restrict you to editing both X and V simultaneously; e.g. F.SetData(newX,newV), and this has the same overhead as GRIDDATA.

Thanks for taking the time to provide feedback, we will use it to improve the documentation for this feature.</description>
		<content:encoded><![CDATA[<p>Mike,</p>
<p>	In item #21 above, I outlined the approach to handling duplicate data points in the scenario where the interpolant is to be reused with different values V. This suggests removing the duplicates prior to performing the interpolation and the steps to do this are provided.</p>
<p>TriScatteredInterp allows X and V to behave independently of each other. This flexibility allows the underlying triangulation to be reused when V is changed and this is very desirable because a retriangulation of X incurs an overhead. In your duplicate point scenario X and V are not strictly independent of each other and the design cannot handle both situations faithfully.</p>
<p>TriScatteredInterp cannot and should not remember which points were merged when the interpolant was created,<br />
because when the interpolant is subsequently edited we cannot assume intent.</p>
<p>The user may wish to replace V and retain the same locations X, OR the user may wish to replace V and then replace X with a completely different set of locations.<br />
A more conservative design would restrict you to editing both X and V simultaneously; e.g. F.SetData(newX,newV), and this has the same overhead as GRIDDATA.</p>
<p>Thanks for taking the time to provide feedback, we will use it to improve the documentation for this feature.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31583</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 13 Aug 2010 00:27:46 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31583</guid>
		<description>Hi,

I&#039;m trying to use TriScatteredInterp, but there&#039;s a catch. The x,y points apparently has some repetition. When I run TriScatteredInterp, I get the following message:

&quot;Warning: Duplicate data points have been detected and removed - corresponding values have been averaged.&quot;

That&#039;s all fine and dandy. (technically though, the message shows up even if there are no values to average - i.e. if I just introduced x,y data by F.X = XY)

But the problem is that I cannot reuse this interpolation F to run over the same x,y points with a different set of z-data, because the other z-data defined over the same x,y will not have the redundant points removed. And that only works if the z-data and x,y are introduced together via the function - F = TriScatteredInterp(X, V). First getting an empty F, then setting F.X = XY, then F.V = data will not work.

If I attempt to use F with other z-data, I get:

&quot;??? Error using ==&gt; subsref
The interpolant is in an invalid state.
The number of data point locations should equal the number of data point values.&quot;

In this case, it looks like I have to create a new interpolant for every set of z-data, which seems highly inefficient, and is only due to a trivial problem of not knowing how to remove the redundant points in the same way.

So I was wondering if you had a solution for this. I could try to manually remove redundant points beforehand, but then I have the added overhead of remembering some indexing matrix for removing redundant points and applying it to any future z-data that may be used, and also averaging the redundant values.

I would suggest that it would be a lot cleaner to internalize this somehow. Since the interpolant is designed to be re-used for different z-data over the same x,y points, it should remember if it had to pre-process the x,y points. Then, any z-data introduced by F.V = data should undergo the same pre-processing, so that the user doesn&#039;t have to worry about nitty gritty details like this.

Maybe I&#039;m just using this wrong and there is an easier way, in which case please let me know!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;m trying to use TriScatteredInterp, but there&#8217;s a catch. The x,y points apparently has some repetition. When I run TriScatteredInterp, I get the following message:</p>
<p>&#8220;Warning: Duplicate data points have been detected and removed &#8211; corresponding values have been averaged.&#8221;</p>
<p>That&#8217;s all fine and dandy. (technically though, the message shows up even if there are no values to average &#8211; i.e. if I just introduced x,y data by F.X = XY)</p>
<p>But the problem is that I cannot reuse this interpolation F to run over the same x,y points with a different set of z-data, because the other z-data defined over the same x,y will not have the redundant points removed. And that only works if the z-data and x,y are introduced together via the function &#8211; F = TriScatteredInterp(X, V). First getting an empty F, then setting F.X = XY, then F.V = data will not work.</p>
<p>If I attempt to use F with other z-data, I get:</p>
<p>&#8220;??? Error using ==&gt; subsref<br />
The interpolant is in an invalid state.<br />
The number of data point locations should equal the number of data point values.&#8221;</p>
<p>In this case, it looks like I have to create a new interpolant for every set of z-data, which seems highly inefficient, and is only due to a trivial problem of not knowing how to remove the redundant points in the same way.</p>
<p>So I was wondering if you had a solution for this. I could try to manually remove redundant points beforehand, but then I have the added overhead of remembering some indexing matrix for removing redundant points and applying it to any future z-data that may be used, and also averaging the redundant values.</p>
<p>I would suggest that it would be a lot cleaner to internalize this somehow. Since the interpolant is designed to be re-used for different z-data over the same x,y points, it should remember if it had to pre-process the x,y points. Then, any z-data introduced by F.V = data should undergo the same pre-processing, so that the user doesn&#8217;t have to worry about nitty gritty details like this.</p>
<p>Maybe I&#8217;m just using this wrong and there is an easier way, in which case please let me know!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damian Sheehy</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31581</link>
		<dc:creator>Damian Sheehy</dc:creator>
		<pubDate>Thu, 12 Aug 2010 17:10:29 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31581</guid>
		<description>Huseyin, Mike,

It is difficult to quantify the performance improvements that can be gained by modularizing your code into functions. It depends on several factors including the functions you are calling, the size of the data, and level of iteration involved, etc. The large performance gains that Mike observed are probably unique to the computational geometry classes in the context of problem size and level of iteration. MATLAB code is designed to execute with optimal performance when structured into functions, so you do not need to be concerned about the internals if you adopt this recommended approach when developing MATLAB applications.</description>
		<content:encoded><![CDATA[<p>Huseyin, Mike,</p>
<p>It is difficult to quantify the performance improvements that can be gained by modularizing your code into functions. It depends on several factors including the functions you are calling, the size of the data, and level of iteration involved, etc. The large performance gains that Mike observed are probably unique to the computational geometry classes in the context of problem size and level of iteration. MATLAB code is designed to execute with optimal performance when structured into functions, so you do not need to be concerned about the internals if you adopt this recommended approach when developing MATLAB applications.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31576</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Wed, 11 Aug 2010 16:07:21 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31576</guid>
		<description>My code was in a .m file, but it was not a function.  I added only a &quot;function name()&quot; line to the top, and it cut execution time from 7 hrs to 7 mins.  Thanks, Damian.

Is such a performance improvement attributable to functions being fully parsed before execution, while scripts are not?</description>
		<content:encoded><![CDATA[<p>My code was in a .m file, but it was not a function.  I added only a &#8220;function name()&#8221; line to the top, and it cut execution time from 7 hrs to 7 mins.  Thanks, Damian.</p>
<p>Is such a performance improvement attributable to functions being fully parsed before execution, while scripts are not?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Huseyin</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31575</link>
		<dc:creator>Huseyin</dc:creator>
		<pubDate>Wed, 11 Aug 2010 14:15:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31575</guid>
		<description>Damian, this is interesting. Are there other functions that benefit from function optimization as much as this? How do we predict if a function will be faster inside a function rather than a script?</description>
		<content:encoded><![CDATA[<p>Damian, this is interesting. Are there other functions that benefit from function optimization as much as this? How do we predict if a function will be faster inside a function rather than a script?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Damian Sheehy</title>
		<link>http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31574</link>
		<dc:creator>Damian Sheehy</dc:creator>
		<pubDate>Tue, 10 Aug 2010 15:54:45 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/07/22/computational-geometry-in-matlab-r2009a-part-ii/#comment-31574</guid>
		<description>Huseyin,

That’s correct, the code must reside in a function to achieve optimal performance.
When MATLAB executes a program that is composed of functions that reside in files, it has a complete picture of the execution of the code; this allows MATLAB to optimize for performance. When you type the code at the prompt MATLAB cannot anticipate what you are going to type next so it cannot perform the same level of optimization. Developing applications through the creation of reusable functions is general and recommended practice, and MATLAB will optimize the performance in this setting.</description>
		<content:encoded><![CDATA[<p>Huseyin,</p>
<p>That’s correct, the code must reside in a function to achieve optimal performance.<br />
When MATLAB executes a program that is composed of functions that reside in files, it has a complete picture of the execution of the code; this allows MATLAB to optimize for performance. When you type the code at the prompt MATLAB cannot anticipate what you are going to type next so it cannot perform the same level of optimization. Developing applications through the creation of reusable functions is general and recommended practice, and MATLAB will optimize the performance in this setting.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

