作者Append (<( ̄︶ ̄)>)
看板MATLAB
标题Re: [问题] 最小方差解
时间Tue Aug 10 01:30:40 2010
1F:推 zhewei:\ 08/08 21:28
2F:→ zhewei:\是matlab帮你弄好的,不用\ 也可以参考我po的网址来求解 08/08 21:50
3F:推 Append:doc mldivide里面有写吧@___@"" 08/08 23:06
4F:推 YoursEver:预设是用QR分解来解,若考虑到condition number之类的问 08/09 00:36
5F:→ YoursEver:题,可以查查Householder/Givens该怎麽写. (Matlab) 08/09 00:37
6F:→ waveken:如果他要求LSM 怎可能是用反矩阵就求解出来 08/09 23:24
7F:→ waveken:除非他问错问题 ! 或是他写的方式让大家误解! 08/09 23:24
虽然确实不能算是反矩阵...不过就是这样喔。=P
首先是解法。"/" (也就是mldivide)
mldivide at MATLAB Documentation
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/mldivide.html
Least Squares Solutions
If the equation Ax = b does not have a solution (and A is not a square
matrix),
x = A\b returns a least squares solution — in other words, a
solution that minimizes the length of the vector Ax - b, which is equal to
norm(A*x - b). See Example 3 for an example of this.
.
.
.
If A is not square, then Householder reflections are used to compute an
orthogonal-triangular factorization.
A*P = Q*R
where P is a permutation, Q is orthogonal and R is upper triangular (see qr).
The least squares solution X is computed with X = P*(R\(Q'*B))
Least Squares Solutions at Wolfram Mathworld
http://ppt.cc/sJAV
A general way to find a least squares solution to an overdetermined system is
to use a singular value decomposition to form a matrix that is known as the
pseudo-inverse of a matrix. In Mathematica this is computed with
PseudoInverse. This technique works even if the input matrix is rank
deficient. The basis of the technique is given below.
好这样应该够了。
有兴趣的话,
Moore-Penrose Matrix Inverse at Wolfram Mathworld
http://ppt.cc/PhR~
顺便说,MATLAB Documentation建议,
解这个问题的时候尽量不要生出inverse(喔当然这里是pseudo-inverse),
而是直接用"\"。
A frequent misuse of inv arises when solving the system of linear equations.
One way to solve this is with x = inv(A)*b.
A better way, from both an execution time and numerical accuracy standpoint,
is to use the matrix division operator x = A\b.
----
另外,如果是我们真的误解了的话,请放心的说出来。...
以上。=)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 219.71.211.169
8F:推 waveken:我是猜的问题没有那麽单纯 08/10 15:07
9F:→ waveken:应该是constrained linear least-squares problems 08/10 15:08
10F:→ waveken:function lsqlin 之类的 08/10 15:08
11F:→ waveken:某些值需要叠代 不然他直接说解反矩阵就好啦 ! 08/10 15:09
12F:→ waveken:所以我才说 可能他讲错 或讲不够详细 ! 08/10 15:11
13F:→ waveken:不然就是他们老师故做玄虚拉 ! 08/10 15:13
14F:→ Append:...为什麽是他们老师? 我猜不出来这跟他们老师的关系... 08/10 15:15
15F:→ Append:另外 一个星期以来我第一次看到你推文里面有指引... 08/10 15:17
16F:→ waveken:AX=B A,B是常数矩阵;仅X未知 那应该是我想太复杂了! 08/10 15:19
17F:→ waveken:Append 问太简单的 我还是没回答吧 ! 08/10 15:19
18F:→ waveken:有的我做过or我会then我就指引拉! 08/10 15:20