Matlab左-向量除法? [英] Matlab left - division in vectors?

查看:116
本文介绍了Matlab左-向量除法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

x = [1; 2; 3]

x=[1;2;3]

x =

 1
 2
 3

y = [4; 5; 6]

y=[4;5;6]

y =

 4
 5
 6

x \ y

x\y

ans =

2.2857

Matlab如何找到该结果? (我搜索了许多论坛,但我不明白他们讲的是什么.我想知道给出此结果的算法.)

How did Matlab find that result ? (I searched many forums but I did not understand what they told.I would like to know the algorithm which gave this result.)

推荐答案

来自\的MATLAB文档:

From MATLAB documentation of \:

如果A是具有M < or > NM-by-N矩阵,而B是具有M个分量的列向量,或者是具有多个此类列的矩阵,则X = A\B是下划线或下划线的最小二乘解.方程组A*X = B的超定系统.

If A is an M-by-N matrix with M < or > 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 A*X = B.

在这里,您的系统不是欠佳/超额预定的.由于两者都有3行.因此,您可以将方程式可视化为:

Here your system is not under/over-determined. Since both have 3 rows. So you can visualize your equation as:

xM=y
M=inv(x)*y

现在,由于矩阵不是正方形,它将使用SVD计算伪逆.因此,

Now, since your matrix is not square, it will calculate the pseudo-inverse using SVD. Therefore,

M=pinv(x)*y;

您将获得M的值为2.2857.

You will get value of M as 2.2857.

另一个解释可能是:它将以最小二乘的形式为您提供xM=y的解决方案.您可以按照以下步骤进行验证:

Another explanation can be: It will give you the solution of xM=y in the sense of least squares. You can verify this as follows:

M=lsqr(x,y)

这将为您提供M = 2.2857的值.

This will give you the value of M = 2.2857.

您始终可以在MATLAB命令窗口中执行help \以获得更多信息.

You can always do help \ in MATLAB command window to get more information.

鼓励您检查有关最小二乘和伪逆的更多详细信息.

You are encouraged to check more details about the least squares and pseudo-inverse.

这篇关于Matlab左-向量除法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆