File: Linear-Least-Squares.html

package info (click to toggle)
octave 10.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 145,388 kB
  • sloc: cpp: 335,976; ansic: 82,241; fortran: 20,963; objc: 9,402; sh: 8,756; yacc: 4,392; lex: 4,333; perl: 1,544; java: 1,366; awk: 1,259; makefile: 660; xml: 192
file content (448 lines) | stat: -rw-r--r-- 28,336 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Linear Least Squares (GNU Octave (version 10.3.0))</title>

<meta name="description" content="Linear Least Squares (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Linear Least Squares (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Optimization.html" rel="up" title="Optimization">
<link href="Nonlinear-Programming.html" rel="prev" title="Nonlinear Programming">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
ul.mark-bullet {list-style-type: disc}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<div class="section-level-extent" id="Linear-Least-Squares">
<div class="nav-panel">
<p>
Previous: <a href="Nonlinear-Programming.html" accesskey="p" rel="prev">Nonlinear Programming</a>, Up: <a href="Optimization.html" accesskey="u" rel="up">Optimization</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Linear-Least-Squares-1"><span>25.4 Linear Least Squares<a class="copiable-link" href="#Linear-Least-Squares-1"> &para;</a></span></h3>

<p>Octave also supports linear least squares minimization.  That is,
Octave can find the parameter <em class="math">b</em> such that the model
<em class="math">y = x*b</em>
fits data <em class="math">(x,y)</em> as well as possible, assuming zero-mean
Gaussian noise.  If the noise is assumed to be isotropic the problem
can be solved using the &lsquo;<samp class="samp">\</samp>&rsquo; or &lsquo;<samp class="samp">/</samp>&rsquo; operators, or the <code class="code">ols</code>
function.  In the general case where the noise is assumed to be anisotropic
the <code class="code">gls</code> is needed.
</p>
<a class="anchor" id="XREFols"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-ols"><span><code class="def-type">[<var class="var">beta</var>, <var class="var">sigma</var>, <var class="var">r</var>] =</code> <strong class="def-name">ols</strong> <code class="def-code-arguments">(<var class="var">y</var>, <var class="var">x</var>)</code><a class="copiable-link" href="#index-ols"> &para;</a></span></dt>
<dd><p>Ordinary least squares (OLS) estimation.
</p>
<p>OLS applies to the multivariate model
<em class="math"><var class="var">y</var> = <var class="var">x</var>*<var class="var">b</var> + <var class="var">e</var></em><!-- /@w -->
where
<em class="math"><var class="var">y</var></em> is a <em class="math">t</em>-by-<em class="math">p</em> matrix, <em class="math"><var class="var">x</var></em> is a
<em class="math">t</em>-by-<em class="math">k</em> matrix, <var class="var">b</var> is a <em class="math">k</em>-by-<em class="math">p</em> matrix, and
<var class="var">e</var> is a <em class="math">t</em>-by-<em class="math">p</em> matrix.
</p>
<p>Each row of <var class="var">y</var> is a <em class="math">p</em>-variate observation in which each column
represents a variable.  Likewise, the rows of <var class="var">x</var> represent
<em class="math">k</em>-variate observations or possibly designed values.  Furthermore,
the collection of observations <var class="var">x</var> must be of adequate rank, <em class="math">k</em>,
otherwise <var class="var">b</var> cannot be uniquely estimated.
</p>
<p>The observation errors, <var class="var">e</var>, are assumed to originate from an
underlying <em class="math">p</em>-variate distribution with zero mean and
<em class="math">p</em>-by-<em class="math">p</em> covariance matrix <var class="var">S</var>, both constant conditioned
on <var class="var">x</var>.  Furthermore, the matrix <var class="var">S</var> is constant with respect to
each observation such that
<code class="code">mean (<var class="var">e</var>) = 0</code> and
<code class="code">cov (vec (<var class="var">e</var>)) = kron (<var class="var">s</var>, <var class="var">I</var>)</code>.
(For cases
that don&rsquo;t meet this criteria, such as autocorrelated errors, see
generalized least squares, gls, for more efficient estimations.)
</p>
<p>The return values <var class="var">beta</var>, <var class="var">sigma</var>, and <var class="var">r</var> are defined as
follows.
</p>
<dl class="table">
<dt><var class="var">beta</var></dt>
<dd><p>The OLS estimator for matrix <var class="var">b</var>.
<var class="var">beta</var> is calculated directly via
<code class="code">inv (<var class="var">x</var>'*<var class="var">x</var>) * <var class="var">x</var>' * <var class="var">y</var></code> if the matrix
<code class="code"><var class="var">x</var>'*<var class="var">x</var></code> is of full rank.
Otherwise, <code class="code"><var class="var">beta</var> = pinv (<var class="var">x</var>) * <var class="var">y</var></code> where
<code class="code">pinv (<var class="var">x</var>)</code> denotes the pseudoinverse of <var class="var">x</var>.
</p>
</dd>
<dt><var class="var">sigma</var></dt>
<dd><p>The OLS estimator for the matrix <var class="var">s</var>,
</p>
<div class="example">
<div class="group"><pre class="example-preformatted"><var class="var">sigma</var> = (<var class="var">y</var>-<var class="var">x</var>*<var class="var">beta</var>)' * (<var class="var">y</var>-<var class="var">x</var>*<var class="var">beta</var>) / (<em class="math">t</em>-rank(<var class="var">x</var>))
</pre></div></div>

</dd>
<dt><var class="var">r</var></dt>
<dd><p>The matrix of OLS residuals, <code class="code"><var class="var">r</var> = <var class="var">y</var> - <var class="var">x</var>*<var class="var">beta</var></code>.
</p></dd>
</dl>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFgls">gls</a>, <a class="ref" href="Basic-Matrix-Functions.html#XREFpinv">pinv</a>.
</p></dd></dl>


<a class="anchor" id="XREFgls"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-gls"><span><code class="def-type">[<var class="var">beta</var>, <var class="var">v</var>, <var class="var">r</var>] =</code> <strong class="def-name">gls</strong> <code class="def-code-arguments">(<var class="var">y</var>, <var class="var">x</var>, <var class="var">o</var>)</code><a class="copiable-link" href="#index-gls"> &para;</a></span></dt>
<dd><p>Generalized least squares (GLS) model.
</p>
<p>Perform a generalized least squares estimation for the multivariate model
<em class="math"><var class="var">y</var> = <var class="var">x</var>*<var class="var">B</var> + <var class="var">E</var></em><!-- /@w -->
where
<var class="var">y</var> is a <em class="math">t</em>-by-<em class="math">p</em> matrix, <var class="var">x</var> is a
<em class="math">t</em>-by-<em class="math">k</em> matrix, <var class="var">b</var> is a <em class="math">k</em>-by-<em class="math">p</em> matrix
and <var class="var">e</var> is a <em class="math">t</em>-by-<em class="math">p</em> matrix.
</p>
<p>Each row of <var class="var">y</var> is a <em class="math">p</em>-variate observation in which each column
represents a variable.  Likewise, the rows of <var class="var">x</var> represent
<em class="math">k</em>-variate observations or possibly designed values.  Furthermore,
the collection of observations <var class="var">x</var> must be of adequate rank, <em class="math">k</em>,
otherwise <var class="var">b</var> cannot be uniquely estimated.
</p>
<p>The observation errors, <var class="var">e</var>, are assumed to originate from an
underlying <em class="math">p</em>-variate distribution with zero mean but possibly
heteroscedastic observations.  That is, in general,
<code class="code"><em class="math">mean (<var class="var">e</var>) = 0</em></code> and
<code class="code"><em class="math">cov (vec (<var class="var">e</var>)) = (<em class="math">s</em>^2)*<var class="var">o</var></em></code>
in which <em class="math">s</em> is a scalar and <var class="var">o</var> is a
<em class="math">t*p</em>-by-<em class="math">t*p</em>
matrix.
</p>
<p>The return values <var class="var">beta</var>, <var class="var">v</var>, and <var class="var">r</var> are
defined as follows.
</p>
<dl class="table">
<dt><var class="var">beta</var></dt>
<dd><p>The GLS estimator for matrix <var class="var">b</var>.
</p>
</dd>
<dt><var class="var">v</var></dt>
<dd><p>The GLS estimator for scalar <em class="math">s^2</em>.
</p>
</dd>
<dt><var class="var">r</var></dt>
<dd><p>The matrix of GLS residuals, <em class="math"><var class="var">r</var> = <var class="var">y</var> - <var class="var">x</var>*<var class="var">beta</var></em>.
</p></dd>
</dl>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFols">ols</a>.
</p></dd></dl>


<a class="anchor" id="XREFlsqnonneg"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-lsqnonneg"><span><code class="def-type"><var class="var">x</var> =</code> <strong class="def-name">lsqnonneg</strong> <code class="def-code-arguments">(<var class="var">c</var>, <var class="var">d</var>)</code><a class="copiable-link" href="#index-lsqnonneg"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lsqnonneg-1"><span><code class="def-type"><var class="var">x</var> =</code> <strong class="def-name">lsqnonneg</strong> <code class="def-code-arguments">(<var class="var">c</var>, <var class="var">d</var>, <var class="var">x0</var>)</code><a class="copiable-link" href="#index-lsqnonneg-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lsqnonneg-2"><span><code class="def-type"><var class="var">x</var> =</code> <strong class="def-name">lsqnonneg</strong> <code class="def-code-arguments">(<var class="var">c</var>, <var class="var">d</var>, <var class="var">x0</var>, <var class="var">options</var>)</code><a class="copiable-link" href="#index-lsqnonneg-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lsqnonneg-3"><span><code class="def-type">[<var class="var">x</var>, <var class="var">resnorm</var>] =</code> <strong class="def-name">lsqnonneg</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-lsqnonneg-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lsqnonneg-4"><span><code class="def-type">[<var class="var">x</var>, <var class="var">resnorm</var>, <var class="var">residual</var>] =</code> <strong class="def-name">lsqnonneg</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-lsqnonneg-4"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lsqnonneg-5"><span><code class="def-type">[<var class="var">x</var>, <var class="var">resnorm</var>, <var class="var">residual</var>, <var class="var">exitflag</var>] =</code> <strong class="def-name">lsqnonneg</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-lsqnonneg-5"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lsqnonneg-6"><span><code class="def-type">[<var class="var">x</var>, <var class="var">resnorm</var>, <var class="var">residual</var>, <var class="var">exitflag</var>, <var class="var">output</var>] =</code> <strong class="def-name">lsqnonneg</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-lsqnonneg-6"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lsqnonneg-7"><span><code class="def-type">[<var class="var">x</var>, <var class="var">resnorm</var>, <var class="var">residual</var>, <var class="var">exitflag</var>, <var class="var">output</var>, <var class="var">lambda</var>] =</code> <strong class="def-name">lsqnonneg</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-lsqnonneg-7"> &para;</a></span></dt>
<dd>
<p>Minimize <code class="code">norm (<var class="var">c</var>*<var class="var">x</var> - <var class="var">d</var>)</code> subject to
<code class="code"><var class="var">x</var> &gt;= 0</code>.
</p>
<p><var class="var">c</var> and <var class="var">d</var> must be real matrices.
</p>
<p><var class="var">x0</var> is an optional initial guess for the solution <var class="var">x</var>.
</p>
<p><var class="var">options</var> is an options structure to change the behavior of the
algorithm (see <a class="pxref" href="#XREFoptimset"><code class="code">optimset</code></a>).  <code class="code">lsqnonneg</code>
recognizes these options: <code class="code">&quot;MaxIter&quot;</code>, <code class="code">&quot;TolX&quot;</code>.
</p>
<p>Outputs:
</p>
<dl class="table">
<dt><var class="var">resnorm</var></dt>
<dd><p>The squared 2-norm of the residual: <code class="code">norm (<var class="var">c</var>*<var class="var">x</var>-<var class="var">d</var>)^2</code>
</p>
</dd>
<dt><var class="var">residual</var></dt>
<dd><p>The residual: <code class="code"><var class="var">d</var>-<var class="var">c</var>*<var class="var">x</var></code>
</p>
</dd>
<dt><var class="var">exitflag</var></dt>
<dd><p>An indicator of convergence.  0 indicates that the iteration count was
exceeded, and therefore convergence was not reached; &gt;0 indicates that the
algorithm converged.  (The algorithm is stable and will converge given
enough iterations.)
</p>
</dd>
<dt><var class="var">output</var></dt>
<dd><p>A structure with two fields:
</p>
<ul class="itemize mark-bullet">
<li><code class="code">&quot;algorithm&quot;</code>: The algorithm used (<code class="code">&quot;nnls&quot;</code>)

</li><li><code class="code">&quot;iterations&quot;</code>: The number of iterations taken.
</li></ul>

</dd>
<dt><var class="var">lambda</var></dt>
<dd><p>Lagrange multipliers.  If these are nonzero, the corresponding <var class="var">x</var>
values should be zero, indicating the solution is pressed up against a
coordinate plane.  The magnitude indicates how much the residual would
improve if the <code class="code"><var class="var">x</var> &gt;= 0</code> constraints were relaxed in that
direction.
</p>
</dd>
</dl>

<p><strong class="strong">See also:</strong> <a class="ref" href="Quadratic-Programming.html#XREFpqpnonneg">pqpnonneg</a>, <a class="ref" href="#XREFlscov">lscov</a>, <a class="ref" href="#XREFoptimset">optimset</a>.
</p></dd></dl>


<a class="anchor" id="XREFlscov"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-lscov"><span><code class="def-type"><var class="var">x</var> =</code> <strong class="def-name">lscov</strong> <code class="def-code-arguments">(<var class="var">A</var>, <var class="var">b</var>)</code><a class="copiable-link" href="#index-lscov"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lscov-1"><span><code class="def-type"><var class="var">x</var> =</code> <strong class="def-name">lscov</strong> <code class="def-code-arguments">(<var class="var">A</var>, <var class="var">b</var>, <var class="var">V</var>)</code><a class="copiable-link" href="#index-lscov-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lscov-2"><span><code class="def-type"><var class="var">x</var> =</code> <strong class="def-name">lscov</strong> <code class="def-code-arguments">(<var class="var">A</var>, <var class="var">b</var>, <var class="var">V</var>, <var class="var">alg</var>)</code><a class="copiable-link" href="#index-lscov-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-lscov-3"><span><code class="def-type">[<var class="var">x</var>, <var class="var">stdx</var>, <var class="var">mse</var>, <var class="var">S</var>] =</code> <strong class="def-name">lscov</strong> <code class="def-code-arguments">(&hellip;)</code><a class="copiable-link" href="#index-lscov-3"> &para;</a></span></dt>
<dd>
<p>Compute a generalized linear least squares fit.
</p>
<p>Estimate <var class="var">x</var> under the model <var class="var">b</var> = <var class="var">A</var><var class="var">x</var> + <var class="var">w</var>, where
the noise <var class="var">w</var> is assumed to follow a normal distribution with covariance
matrix <em class="math">{\sigma^2} V</em>.
</p>
<p>If the size of the coefficient matrix <var class="var">A</var> is n-by-p, the size of the
vector/array of constant terms <var class="var">b</var> must be n-by-k.
</p>
<p>The optional input argument <var class="var">V</var> may be an n-element vector of positive
weights (inverse variances), or an n-by-n symmetric positive semi-definite
matrix representing the covariance of <var class="var">b</var>.  If <var class="var">V</var> is not supplied,
the ordinary least squares solution is returned.
</p>
<p>The <var class="var">alg</var> input argument, a guidance on solution method to use, is
currently ignored.
</p>
<p>Besides the least-squares estimate matrix <var class="var">x</var> (p-by-k), the function
also returns <var class="var">stdx</var> (p-by-k), the error standard deviation of estimated
<var class="var">x</var>; <var class="var">mse</var> (k-by-1), the estimated data error covariance scale
factors (<em class="math">\sigma^2</em>); and <var class="var">S</var> (p-by-p, or p-by-p-by-k if k &gt; 1),
the error covariance of <var class="var">x</var>.
</p>
<p>Reference: Golub and Van Loan (1996),
<cite class="cite">Matrix Computations (3rd Ed.)</cite>, Johns Hopkins, Section 5.6.3
</p>

<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFols">ols</a>, <a class="ref" href="#XREFgls">gls</a>, <a class="ref" href="#XREFlsqnonneg">lsqnonneg</a>.
</p></dd></dl>


<a class="anchor" id="XREFoptimset"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-optimset"><span><strong class="def-name">optimset</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-optimset"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-optimset-1"><span><code class="def-type"><var class="var">options</var> =</code> <strong class="def-name">optimset</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-optimset-1"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-optimset-2"><span><code class="def-type"><var class="var">options</var> =</code> <strong class="def-name">optimset</strong> <code class="def-code-arguments">(<var class="var">par</var>, <var class="var">val</var>, &hellip;)</code><a class="copiable-link" href="#index-optimset-2"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-optimset-3"><span><code class="def-type"><var class="var">options</var> =</code> <strong class="def-name">optimset</strong> <code class="def-code-arguments">(<var class="var">old</var>, <var class="var">par</var>, <var class="var">val</var>, &hellip;)</code><a class="copiable-link" href="#index-optimset-3"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-optimset-4"><span><code class="def-type"><var class="var">options</var> =</code> <strong class="def-name">optimset</strong> <code class="def-code-arguments">(<var class="var">old</var>, <var class="var">new</var>)</code><a class="copiable-link" href="#index-optimset-4"> &para;</a></span></dt>
<dd><p>Create options structure for optimization functions.
</p>
<p>When called without any input or output arguments, <code class="code">optimset</code> prints
a list of all valid optimization parameters.
</p>
<p>When called with one output and no inputs, return an options structure with
all valid option parameters initialized to <code class="code">[]</code>.
</p>
<p>When called with a list of parameter/value pairs, return an options
structure with only the named parameters initialized.
</p>
<p>When the first input is an existing options structure <var class="var">old</var>, the values
are updated from either the <var class="var">par</var>/<var class="var">val</var> list or from the options
structure <var class="var">new</var>.
</p>
<p>If <var class="var">par</var> does not exactly match the name of a standard parameter,
<code class="code">optimset</code> will attempt to match <var class="var">par</var> to a standard parameter
and will set the value of that parameter if a match is found.  Matching is
case insensitive and is based on character matching at the start of the
parameter name.  <code class="code">optimset</code> produces an error if it finds multiple
ambiguous matches.  If no standard parameter matches are found a warning is
issued and the non-standard parameter is created.
</p>
<p>Standard list of valid parameters:
</p>
<dl class="table">
<dt>AutoScaling</dt>
<dt>ComplexEqn</dt>
<dt>Display</dt>
<dd><p>Request verbose display of results from optimizations.  Values are:
</p>
<dl class="table">
<dt><code class="code">&quot;off&quot;</code> [default]</dt>
<dd><p>No display.
</p>
</dd>
<dt><code class="code">&quot;iter&quot;</code></dt>
<dd><p>Display intermediate results for every loop iteration.
</p>
</dd>
<dt><code class="code">&quot;final&quot;</code></dt>
<dd><p>Display the result of the final loop iteration.
</p>
</dd>
<dt><code class="code">&quot;notify&quot;</code></dt>
<dd><p>Display the result of the final loop iteration if the function has
failed to converge.
</p></dd>
</dl>

</dd>
<dt>FinDiffType</dt>
<dt>FunValCheck</dt>
<dd><p>When enabled, display an error if the objective function returns an invalid
value (a complex number, NaN, or Inf).  Must be set to <code class="code">&quot;on&quot;</code> or
<code class="code">&quot;off&quot;</code> [default].  Note: the functions <code class="code">fzero</code> and
<code class="code">fminbnd</code> correctly handle Inf values and only complex values or NaN
will cause an error in this case.
</p>
</dd>
<dt>GradObj</dt>
<dd><p>When set to <code class="code">&quot;on&quot;</code>, the function to be minimized must return a
second argument which is the gradient, or first derivative, of the
function at the point <var class="var">x</var>.  If set to <code class="code">&quot;off&quot;</code> [default], the
gradient is computed via finite differences.
</p>
</dd>
<dt>Jacobian</dt>
<dd><p>When set to <code class="code">&quot;on&quot;</code>, the function to be minimized must return a
second argument which is the Jacobian, or first derivative, of the
function at the point <var class="var">x</var>.  If set to <code class="code">&quot;off&quot;</code> [default], the
Jacobian is computed via finite differences.
</p>
</dd>
<dt>MaxFunEvals</dt>
<dd><p>Maximum number of function evaluations before optimization stops.
Must be a positive integer.
</p>
</dd>
<dt>MaxIter</dt>
<dd><p>Maximum number of algorithm iterations before optimization stops.
Must be a positive integer.
</p>
</dd>
<dt>OutputFcn</dt>
<dd><p>A user-defined function executed once per algorithm iteration.
</p>
</dd>
<dt>TolFun</dt>
<dd><p>Termination criterion for the function output.  If the difference in the
calculated objective function between one algorithm iteration and the next
is less than <code class="code">TolFun</code> the optimization stops.  Must be a positive
scalar.
</p>
</dd>
<dt>TolX</dt>
<dd><p>Termination criterion for the function input.  If the difference in <var class="var">x</var>,
the current search point, between one algorithm iteration and the next is
less than <code class="code">TolX</code> the optimization stops.  Must be a positive scalar.
</p>
</dd>
<dt>TypicalX</dt>
<dt>Updating</dt>
</dl>

<p>This list can be extended by the user or other loaded Octave packages.  An
updated valid parameters list can be queried using the no-argument form of
<code class="code">optimset</code>.
</p>
<p>Note 1: Only parameter names from the standard list are considered when
matching short parameter names, and <var class="var">par</var> will always be expanded
to match a standard parameter even if an exact non-standard match exists.
The value of a non-standard parameter that is ambiguous with one or more
standard parameters cannot be set by <code class="code">optimset</code> and can only be set
using <code class="code">setfield</code> or dot notation for structs.
</p>
<p>Note 2: The optimization options structure is primarily intended for
manipulation of known parameters by <code class="code">optimset</code> and <code class="code">optimget</code>.
Unpredictable behavior on future calls to <code class="code">optimset</code> or
<code class="code">optimget</code> can result from creating non-standard or ambiguous
parameters or from loading/unloading packages that change the known
parameter list after creation of an optimization options structure.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFoptimget">optimget</a>.
</p></dd></dl>


<a class="anchor" id="XREFoptimget"></a><span style="display:block; margin-top:-4.5ex;">&nbsp;</span>


<dl class="first-deftypefn">
<dt class="deftypefn" id="index-optimget"><span><code class="def-type"><var class="var">val</var> =</code> <strong class="def-name">optimget</strong> <code class="def-code-arguments">(<var class="var">options</var>, <var class="var">par</var>)</code><a class="copiable-link" href="#index-optimget"> &para;</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-optimget-1"><span><code class="def-type"><var class="var">val</var> =</code> <strong class="def-name">optimget</strong> <code class="def-code-arguments">(<var class="var">options</var>, <var class="var">par</var>, <var class="var">default</var>)</code><a class="copiable-link" href="#index-optimget-1"> &para;</a></span></dt>
<dd><p>Return the value of the specific parameter <var class="var">par</var> from the optimization
options structure <var class="var">options</var> created by <code class="code">optimset</code>.
</p>
<p>If <var class="var">par</var> is not defined then return the <var class="var">default</var> value if
supplied, otherwise return an empty matrix.
</p>
<p>If <var class="var">par</var> does not exactly match the name of a standard parameter,
<code class="code">optimget</code> will attempt to match <var class="var">par</var> to a standard parameter
and will return that parameter&rsquo;s value if a match is found.  Matching is
case insensitive and is based on character matching at the start of the
parameter name.  <code class="code">optimget</code> produces an error if it finds multiple
ambiguous matches.  If no standard parameter matches are found a warning is
issued.  See <code class="code">optimset</code> for information about the standard options
list.
</p>
<p>Note: Only parameter names from the standard list are considered when
matching short parameter names, and <var class="var">par</var> will always be expanded to
match a standard parameter even if an exact non-standard match exists.  The
value of a non-standard parameter that is ambiguous with one or more
standard parameters cannot be returned by <code class="code">optimget</code> and can only be
accessed using <code class="code">getfield</code> or dot notation for structs.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFoptimset">optimset</a>.
</p></dd></dl>



</div>
<hr>
<div class="nav-panel">
<p>
Previous: <a href="Nonlinear-Programming.html">Nonlinear Programming</a>, Up: <a href="Optimization.html">Optimization</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>