日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

点除与矩阵除法

發布時間:2025/5/22 编程问答 54 豆豆
生活随笔 收集整理的這篇文章主要介紹了 点除与矩阵除法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

點除與矩陣除法:?
在書寫程序的時候,點乘和矩陣乘法寫錯的時候再進行程序調適的?
時候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


總結

以上是生活随笔為你收集整理的点除与矩阵除法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。