1
<?xml version="1.0" encoding="UTF-8"?>
3
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4
* Copyright (C) 2008 - INRIA
6
* This file must be used under the terms of the CeCILL.
7
* This source file is licensed as described in the file COPYING, which
8
* you should have received as part of this distribution. The terms
9
* are also available at
10
* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
13
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="ja" xml:id="lsq">
15
<refname>lsq</refname>
16
<refpurpose>線形最小二乗問題. </refpurpose>
20
<synopsis>X=lsq(A,B [,tol])</synopsis>
28
<para>実数または複素数の (m x n) 行列</para>
34
<para>実数または複素数の (m x p) 行列</para>
40
<para>Aの実効ランクを定義するために使用される正のスカラー
41
(Aのピボット操作付きQR分解における最前部にある部分三角行列R11の次数として
42
定義され,条件数の推定値は<= 1/tolとなります.
43
tolのデフォルト値は <literal>sqrt(%eps)</literal>に設定されます )
50
<para>実数または複素数の (n x p) 行列</para>
58
<literal>X=lsq(A,B)</literal> は方程式 <literal>A*X=B</literal>の
60
一方, <literal>X=A \ B</literal>は
61
各列に最大<literal>rank(A)</literal>個の非ゼロ要素を有する最小二乗解を計算します.
67
<literal>lsq</literal> 関数はLApack 関数 DGELSY (実行列の場合)および
68
ZGELSY (複素行列の場合)に基づいています.
73
<programlisting role="example"><![CDATA[
77
y1=3*x+4.5+3*rand(x,'normal');
78
y2=1.8*x+0.5+2*rand(x,'normal');
79
plot2d(x,[y1,y2],[-2,-3])
80
//Find the linear regression
81
A=[x,ones(x)];B=[y1,y2];
86
plot2d(x,[y1e,y2e],[2,3])
88
//Difference between lsq(A,b) and A\b
89
A=rand(4,2)*rand(2,3);//a rank 2 matrix
93
[A*X1-b, A*X2-b] //the residuals are the same
96
<refsection role="see also">
98
<simplelist type="inline">
100
<link linkend="backslash">backslash</link>
103
<link linkend="inv">inv</link>
106
<link linkend="pinv">pinv</link>
109
<link linkend="rank">rank</link>