« 上一篇: 螺旋片helix 下一篇: 关于Axis limits outside float precision的问题 »
萝卜 @ 2008-05-19 18:52

点除与矩阵除法:
在书写程序的时候,点乘和矩阵乘法写错的时候再进行程序调适的
时候MATLAB会返回错误说明。
但是对于点除容易出现问题,下面以一个简单的例子说明这个问题:

比如我们要计算:
A = [1,1];
B = [2,1];
C = A/B;
上面的程序我们计算的是A与B的点除。但是由于疏忽而把点除“./”
写为“/”这样结果是不同的,大家可以看看它们的结果:

>> A/B

ans =

    0.6000
>> A./B

ans =

    0.5000    1.0000

它们的结果明显不同,而用“/”去代替“./”将在以后的计算中引
起误差,程序语法错误很难调适。我们只能从期望的结果来检查程
序。希望网友在书写向量或者矩阵的“点除”和“除法”运算的时
候注意这一点。

下面我们看一下“A/B”的结果是怎么计算的(这里提供一段MATLAB
文档):

/ Slash or matrix right division. B/A is roughly the same
as B*inv(A). More precisely, B/A = (A'\B')'. See \.

\ Backslash or matrix left division. If A is a square matrix,
A\B is roughly the same as inv(A)*B, except it is computed in
a different way. If A is an n-by-n matrix and B is a column
vector with n components, or a matrix with several such columns,
then X = A\B is the solution to the equation AX = B computed by
Gaussian elimination (see Algorithm for details). A warning
message prints if A is badly scaled or nearly singular.

If A is an m-by-n matrix with m ~= n and B is a column vector
with m components, or a matrix with several such columns, then
X = A\B is the solution in the least squares sense to the under-
or overdetermined system of equations AX = B. The effective rank,
k, of A, is determined from the QR decomposition with pivoting
(see "Algorithm" for details). A solution X is computed which has
at most k nonzero components per column. If k < n, this is usually
not the same solution as pinv(A)*B, which is the least squares
solution with the smallest norm, ||X||.

也就是说A/B和A*pinv(B)输出的结果是一样的,如:
>> A=[1,2,3];B=[1,2,1];A/B,A*pinv(B)

ans =

    1.3333


ans =

    1.3333




相关文章:

最新评论


pacino21

2008-05-22 19:46 匿名 219.217.*.*

师兄,你好,我也是HITer,有个问题想要请教你一下哈:

假如我有一组数据(xi,yi)i=0,1,...100

分别做了多项式曲线拟合,分段线性插值,三次样条插值

我想知道哪一种方法的效果更好,也就是更接近实际曲线,应该怎么做?

例如,多项式曲线拟合时,可以用残差平方和来说明拟合曲线与实际曲线的误差值
现在主要是不知道
插值的方法怎么算误差!!

大致的思路是什么?

谢谢!



dpf

2008-05-29 08:34 匿名 222.187.*.*

你好:
我想向你请教一个问题:
我做的是利用三维激光扫描仪对建筑物进行扫描,得到扫描点云.通过数据可以估算出单个点的精度,我想请教一下如何利用matlab来实现点云的拟合,最好能估算出点云的精度,谢谢


评论 / 个人网页 / 扔小纸条
* 昵称

已经注册过? 请登录

新用户请先注册 以便能显示头像及追踪评论回复

Email
网址
* 评论
表情
 


 

分类小组论坛
杂谈 , 娱乐、八卦 , 文学、艺术 , 体育 , 旅游、同城 , 象牙塔 , 情感 , 时尚、生活 , 星座 , 科技

请注意遵守中华人民共和国法律法规, 如威胁到本站生存, 将依法向有关部门报告, 同时本站的相关记录可能成为对您不利的证据.

相关法律法规
全国人大常委会关于维护互联网安全的决定
中华人民共和国计算机信息系统安全保护条例
中华人民共和国计算机信息网络国际联网管理暂行规定
计算机信息网络国际联网安全保护管理办法
计算机信息系统国际联网保密管理规定