为什么MATLAB做数组除法的时候要用平均值?

Why does MATLAB use the average when doing array division?

我在 MATLAB 中有以下变量和代码:

A = [ 2 2 2 2 2 ]
B = [ 1 2 3 4 5 ]
B / A % = 1.5

答案 1.5 实际上是 B 中的值除以 2 的平均值,但为什么 MATLAB 对这些数组和 / 运算符这样做?

编辑:

查看文档 here 靠近页面底部的矩阵右除:

x = B/A where xA = B

...但是乘以上面的 x * A 结果是 [ 3 3 3 3 3 ]。这似乎也没有意义。我在这里也遗漏了什么吗?

c = a/b 执行 右矩阵除法 。和每个元素的划分不一样.

right division operator / (or the mrdivide function) 将求解 x 的线性方程组 xA = B。从上面的文档 link:

If A is a rectangular m-by-n matrix with m ~= n, and B is a matrix with n columns, then x = B/A returns a least-squares solution of the system of equations x*A = B.

它正在计算 x 的值,它最接近最小二乘意义上的解决方案,因为在这种情况下你有一个 underdetermined system of equations。没有确切的解决方案,所以 x*A 不能完全重现 B.