| 11 | 1/1 | 返回列表 |
| 查看: 3403 | 回復: 10 | |||
[交流]
matlab 求解線性方程組Ax=b
|
|||
| x=inv(A)*b;和x=A\b;和迭代法 有什么區(qū)別? 前面兩個求 A逆 的是基于什么? |
» 搶金幣啦!回帖就可以得到:
+1/84
+1/36
+1/34
+1/33
+1/32
+1/12
+1/11
+1/8
+1/7
+1/7
+1/6
+1/5
+1/5
+1/5
+1/4
+1/3
+1/2
+1/1
+1/1
+1/1
|
我大致看了一下matlab help,A\b 根據(jù)A的情況用到幾種不同的算法,如果A是一個方陣,b是一個列向量,此時Ax=b就是你說的線性方程組,\用的算法就是Gauss消去法;如果A不是方陣,那么Ax=b就是一個矩陣方程,其實這時候精確解不一定存在,matlab中的\就用了最小二乘法的思想求了一個近似的x(也可稱為廣義解),算法是QR分解。 可以這個簡單理解,inv(A)*b是A\b的一種特殊情況(線性方程組時),但是A\b更強大,可以求出廣義解。 在計算線性方程組Ax=b時,inv(A)*b和A\b用的數(shù)值算法都是Gauss消去法。至于你說的效率,A\b由于考慮的情況比較龐大,調(diào)用的時候稍微會慢一點,我不認為有質(zhì)的區(qū)別。 |
榮譽版主 (文壇精英)
![]() |
專家經(jīng)驗: +518 |
|
It takes almost two and one half times as long to compute the solution with y = inv(A)*b as with z = A\b. Both produce computed solutions with about the same error, 1.e-6, reflecting the condition number of the matrix. But the size of the residuals, obtained by plugging the computed solution back into the original equations, differs by several orders of magnitude. The direct solution produces residuals on the order of the machine accuracy, even though the system is badly conditioned. The behavior of this example is typical. Using A\b instead of inv(A)*b is two to three times as fast and produces residuals on the order of machine accuracy, relative to the magnitude of the data. |
| 11 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 085600材料與化工求調(diào)劑 +5 | 緒幸與子 2026-03-17 | 5/250 |
|
|---|---|---|---|---|
|
[考研] 工科材料085601 279求調(diào)劑 +3 | 困于星晨 2026-03-17 | 3/150 |
|
|
[考研] 材料與化工專碩調(diào)劑 +5 | heming3743 2026-03-16 | 5/250 |
|
|
[考研] 268求調(diào)劑 +7 | 一定有學上- 2026-03-14 | 8/400 |
|
|
[考研] 一志愿南京大學,080500材料科學與工程,調(diào)劑 +4 | Jy? 2026-03-16 | 4/200 |
|
|
[考研] 材料專碩274一志愿陜西師范大學求調(diào)劑 +5 | 薛云鵬 2026-03-13 | 5/250 |
|
|
[論文投稿] 有沒有大佬發(fā)小論文能帶我個二作 +3 | 增銳漏人 2026-03-17 | 4/200 |
|
|
[基金申請] 國自科面上基金字體 +6 | iwuli 2026-03-12 | 7/350 |
|
|
[考研] 326求調(diào)劑 +4 | 諾貝爾化學獎覬?/a> 2026-03-15 | 7/350 |
|
|
[考研] 321求調(diào)劑 +5 | 大米飯! 2026-03-15 | 5/250 |
|
|
[考研] 285求調(diào)劑 +6 | ytter 2026-03-12 | 6/300 |
|
|
[考研] 0856求調(diào)劑 +3 | 劉夢微 2026-03-15 | 3/150 |
|
|
[考研] 22408總分284求調(diào)劑 +3 | InAspic 2026-03-13 | 3/150 |
|
|
[考研] 328求調(diào)劑 +3 | 5201314Lsy! 2026-03-13 | 6/300 |
|
|
[考研] 279求調(diào)劑 +3 | 抓著星星的女孩 2026-03-10 | 3/150 |
|
|
[考研] 求調(diào)劑(材料與化工327) +4 | 愛吃香菜啦 2026-03-11 | 4/200 |
|
|
[考研] 0703化學一志愿211 總分320求調(diào)劑 +5 | 瑪卡巴卡啊哈 2026-03-11 | 5/250 |
|
|
[考研] 0817化學工程與技術考研312分調(diào)劑 +3 | T123 tt 2026-03-12 | 3/150 |
|
|
[考研] 290求調(diào)劑 +3 | ADT 2026-03-13 | 3/150 |
|
|
[考博] 2026年博士申請 +3 | QwQwQW10 2026-03-11 | 3/150 |
|