<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://eclr.humanities.manchester.ac.uk/index.php?action=history&amp;feed=atom&amp;title=Anonym</id>
		<title>Anonym - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://eclr.humanities.manchester.ac.uk/index.php?action=history&amp;feed=atom&amp;title=Anonym"/>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Anonym&amp;action=history"/>
		<updated>2026-04-25T05:52:56Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.1</generator>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Anonym&amp;diff=646&amp;oldid=prev</id>
		<title>Admin: /* Function Handlers */</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Anonym&amp;diff=646&amp;oldid=prev"/>
				<updated>2012-10-16T12:41:02Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Function Handlers&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 12:41, 16 October 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l34&quot; &gt;Line 34:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 34:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; ans =&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; ans =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; 5.5000&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; 5.5000&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Function handlers are stored in a workspace. Therefore, they can be saved and loaded using standard mat files, can be passed to a function as an input, and returned from a function as an output. For example, you can create a structure with function handlers and pass it as a parameter to optimization routine. This might be quite useful once your estimation results depend on the form of the objective function, and its first and second derivative. For example, minimization of non-linear least squares/normal MLE/t-student MLE; GMM/Empirical Likelihood/Exponential Tilting can be also implemented in this way. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;[[Function#OLSest_in_detail|test]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Function handlers are stored in a workspace. Therefore, they can be saved and loaded using standard mat files, can be passed to a function as an input, and returned from a function as an output. For example, you can create a structure with function handlers and pass it as a parameter to optimization routine. This might be quite useful once your estimation results depend on the form of the objective function, and its first and second derivative. For example, minimization of non-linear least squares/normal MLE/t-student MLE; GMM/Empirical Likelihood/Exponential Tilting can be also implemented in this way.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Anonymous Functions =&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Anonymous Functions =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Anonym&amp;diff=628&amp;oldid=prev</id>
		<title>Admin at 10:27, 16 October 2012</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Anonym&amp;diff=628&amp;oldid=prev"/>
				<updated>2012-10-16T10:27:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:27, 16 October 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot; &gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Function Handlers =&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Function Handlers =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This section is optional. You will be able to write your code without knowing this material. However, function handlers allow you to create a cleaner and less cumbersome code. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;They also &lt;/del&gt;reduce the number of small functions that you can lose track of and, thus, reduce the number of places where you can make a mistake. All objects in MATLAB have its handlers, i.e. variables that allow MATLAB to distinguish one such object from another and refer to it if needed. You are using them if you want to open a file for writing or reading:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This section is optional. You will be able to write your code without knowing this material. However, function handlers allow you to create a cleaner and less cumbersome code. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Anonymous functions &lt;/ins&gt;reduce the number of small functions that you can lose track of and, thus, reduce the number of places where you can make a mistake. All objects in MATLAB have its handlers, i.e. variables that allow MATLAB to distinguish one such object from another and refer to it if needed. You are using them if you want to open a file for writing or reading:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;&amp;#160; fn=fopen(&amp;#039;text.txt&amp;#039;,&amp;#039;w&amp;#039;);&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;&amp;#160; fn=fopen(&amp;#039;text.txt&amp;#039;,&amp;#039;w&amp;#039;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Anonym&amp;diff=617&amp;oldid=prev</id>
		<title>Admin at 09:50, 16 October 2012</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Anonym&amp;diff=617&amp;oldid=prev"/>
				<updated>2012-10-16T09:50:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 09:50, 16 October 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l34&quot; &gt;Line 34:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 34:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; ans =&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; ans =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; 5.5000&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; 5.5000&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Function handlers are stored in a workspace. Therefore, they can be saved and loaded using standard mat files, can be passed to a function as an input, and returned from a function as an output. For example, you can create a structure with function handlers and pass it as a parameter to optimization routine. This might be quite useful once your estimation results depend on the form of the objective function, and its first and second derivative. For example, minimization of non-linear least squares/normal MLE/t-student MLE; GMM/Empirical Likelihood/Exponential Tilting can be also implemented in this way. [[Function#OLSest_in_detail]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Function handlers are stored in a workspace. Therefore, they can be saved and loaded using standard mat files, can be passed to a function as an input, and returned from a function as an output. For example, you can create a structure with function handlers and pass it as a parameter to optimization routine. This might be quite useful once your estimation results depend on the form of the objective function, and its first and second derivative. For example, minimization of non-linear least squares/normal MLE/t-student MLE; GMM/Empirical Likelihood/Exponential Tilting can be also implemented in this way. [[Function#OLSest_in_detail&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|test&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Anonymous Functions =&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Anonymous Functions =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=Anonym&amp;diff=616&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;  = Function Handlers =  This section is optional. You will be able to write your code without knowing this material. However, function handlers allow you to create a cleaner ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=Anonym&amp;diff=616&amp;oldid=prev"/>
				<updated>2012-10-16T09:48:39Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;  = Function Handlers =  This section is optional. You will be able to write your code without knowing this material. However, function handlers allow you to create a cleaner ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
= Function Handlers =&lt;br /&gt;
&lt;br /&gt;
This section is optional. You will be able to write your code without knowing this material. However, function handlers allow you to create a cleaner and less cumbersome code. They also reduce the number of small functions that you can lose track of and, thus, reduce the number of places where you can make a mistake. All objects in MATLAB have its handlers, i.e. variables that allow MATLAB to distinguish one such object from another and refer to it if needed. You are using them if you want to open a file for writing or reading:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;  fn=fopen(&amp;#039;text.txt&amp;#039;,&amp;#039;w&amp;#039;);&lt;br /&gt;
  fprintf(fn,&amp;#039;This is a test\n&amp;#039;);&amp;lt;/source&amp;gt;&lt;br /&gt;
You can use them for creating and manipulating figures:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;f1=figure;&lt;br /&gt;
f2=figure;&lt;br /&gt;
figure(f1)&lt;br /&gt;
title(&amp;#039;This is figure 1&amp;#039;)&lt;br /&gt;
figure(f2)&lt;br /&gt;
title(&amp;#039;This is figure 2&amp;#039;)&amp;lt;/source&amp;gt;&lt;br /&gt;
Functions also have their own handlers. Function handlers have &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;@&amp;lt;/source&amp;gt; in front of them. In fact, you are using them in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;fminunc&amp;lt;/source&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;  fminunc(@my_obj,theta0)&amp;lt;/source&amp;gt;&lt;br /&gt;
Using function handlers you can rename functions without creating your own function files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;  mymean=@mean;&lt;br /&gt;
  c=1:10;&lt;br /&gt;
  mymean(c)&lt;br /&gt;
  ans =&lt;br /&gt;
    5.5000&amp;lt;/source&amp;gt;&lt;br /&gt;
and make fun of a person who’ll try to read your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;  max=@mean;&lt;br /&gt;
  c=1:10;&lt;br /&gt;
  ...&lt;br /&gt;
  ...&lt;br /&gt;
  max(c)&lt;br /&gt;
  ans =&lt;br /&gt;
    5.5000&amp;lt;/source&amp;gt;&lt;br /&gt;
Function handlers are stored in a workspace. Therefore, they can be saved and loaded using standard mat files, can be passed to a function as an input, and returned from a function as an output. For example, you can create a structure with function handlers and pass it as a parameter to optimization routine. This might be quite useful once your estimation results depend on the form of the objective function, and its first and second derivative. For example, minimization of non-linear least squares/normal MLE/t-student MLE; GMM/Empirical Likelihood/Exponential Tilting can be also implemented in this way. [[Function#OLSest_in_detail]]&lt;br /&gt;
&lt;br /&gt;
= Anonymous Functions =&lt;br /&gt;
&lt;br /&gt;
There are many cases when you would like to have a function with one output that can be squeezed in one line. For example, consider a trivial case when you would like to compute a mean along the third dimension of your multidimensional array. You can do it by creating a function file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;  function out=mymean(in)&lt;br /&gt;
  out=mean(in,3);&lt;br /&gt;
  end&amp;lt;/source&amp;gt;&lt;br /&gt;
Alternatively, you can do it by creating an anonymous function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;  mymean=@(x)(mean(x,3));&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;mean&amp;lt;/source&amp;gt; by default computes an average along the second dimension, while &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;mymean&amp;lt;/source&amp;gt; computes an average along the third. There are less trivial examples:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Changing the order of function inputs and/or hiding all other inputs (might be needed for &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;fminunc, fmincon&amp;lt;/source&amp;gt;, etc)&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;    %assume that there is a function that you would like to minimize is myfunc(theta,data1,data2,data3)&lt;br /&gt;
    myfunc1=@(theta)(myfunc(theta,data1,data2,data3));&lt;br /&gt;
    theta=fminunc(myfunc1,theta0);%Note! since myfunc1 IS a handler, you don&amp;#039;t need to put @ in front of it&lt;br /&gt;
                    %compare with&lt;br /&gt;
    theta=fminunc(@myfunct,theta0,[],data1,data2,data3);&lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;#039;&amp;#039;&amp;#039;Important:&amp;#039;&amp;#039;&amp;#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Since anonymous function can return only one output, to provide an analytical gradient and hessian you have to use the following syntax:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;    theta=fminunc({myfunc1, grad, hess},theta0);%grad and hess are anonymous functions that provide gradient and hessian of myfunc1&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;Short example:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;    x2=@(x)x^2+5*x;&lt;br /&gt;
    gx=@(x)2*x+5;&lt;br /&gt;
    hx=@(x)2;&lt;br /&gt;
    &amp;gt;&amp;gt; fminunc({x2,gx,hx},5)&lt;br /&gt;
    ans =&lt;br /&gt;
          -2.5000&amp;lt;/source&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Hiding all irrelevant inputs (it is necessary for various functions that compute integrals, see for example &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;integral&amp;lt;/source&amp;gt;)&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;For double optimization, when you are minimizing with respect to one vector of inputs, while maximizing with respect to another. It allows you to use the same objective function many times&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;        %assume that we have a function EL(beta,lambda,data), and we would like to minimize with respect to beta, while maximizing with respect to lambda:&lt;br /&gt;
        ELmin=@(beta)(EL(beta,lambda,data));&lt;br /&gt;
        ...&lt;br /&gt;
        ...&lt;br /&gt;
        ELmax=@(lambda)(-EL(beta,lambda,data));%we put a minus here, since fminunc minimizes, not maximizes the function&lt;br /&gt;
      &amp;lt;/source&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Important:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Anonymous function can have only one output (it can be anything, but just one variable name)&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;All variables that are not specified as inputs are copied from the workspace at the moment of creating the anonymous function. If you would like to update the values of these variables, you have to recreate your anonymous function:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;source&amp;gt;        a=2;&lt;br /&gt;
        xplusa=@(x)(x+a);&lt;br /&gt;
        &amp;gt;&amp;gt; xplusa(3)&lt;br /&gt;
        ans =&lt;br /&gt;
              5&lt;br /&gt;
        a=0;&lt;br /&gt;
        &amp;gt;&amp;gt; xplusa(3)&lt;br /&gt;
        ans =&lt;br /&gt;
              5&lt;br /&gt;
        xplusa=@(x)(x+a);&lt;br /&gt;
        ans =&lt;br /&gt;
              3&lt;br /&gt;
      &amp;lt;/source&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&amp;lt;p&amp;gt;Anonymous functions are somewhat slower than standard functions.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>