| 7 | 1/1 | 返回列表 |
| 查看: 3113 | 回復(fù): 6 | ||||
cq0932金蟲 (初入文壇)
|
[求助]
求教fsolve如何查看每次迭代的x值?
|
|
利用fsolve可以求解非線性方程的數(shù)值解,但是只有最后的結(jié)果,沒(méi)有每步迭代的x取值。 在求解之前設(shè)置迭代顯示的選項(xiàng) options=optimset('Display','iter'); 輸出窗口中顯示如下: Norm of First-order Trust-region Iteration Func-count f(x) step optimality radius 0 2 2.61482e-007 0.000171 1 1 3 2.61482e-007 0.00152725 0.000171 1 2 5 1.51338e-007 0.000381811 0.000109 0.000382 3 6 1.51338e-007 0.000954528 0.000109 0.000955 4 8 8.78862e-008 0.000238632 8.52e-005 0.000239 5 10 7.98377e-008 0.00059658 8.75e-005 0.000597 6 11 7.98377e-008 0.00059658 8.75e-005 0.000597 7 13 6.53061e-008 0.000149145 8.2e-005 0.000149 8 15 5.49734e-008 0.000149145 7.79e-005 0.000149 9 17 4.84382e-008 0.000149145 7.17e-005 0.000149 10 19 4.1506e-008 0.000149145 6.76e-005 0.000149 11 21 3.68301e-008 0.000149145 6.25e-005 0.000149 12 23 3.1814e-008 0.000149145 5.91e-005 0.000149 13 25 2.87067e-008 0.000149145 5.52e-005 0.000149 14 27 2.5256e-008 0.000149145 5.26e-005 0.000149 15 29 2.33751e-008 0.000149145 4.98e-005 0.000149 16 31 2.10974e-008 0.000149145 4.8e-005 0.000149 輸出結(jié)果只有f(x)的值,請(qǐng)問(wèn)如何設(shè)置才能看到每步迭代的x取值? |
matlab典型案例 |
榮譽(yù)版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗(yàn): +2 |

榮譽(yù)版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗(yàn): +2 |
|
這樣行不,x有3個(gè)的,復(fù)數(shù)輸出如下 Norm of First-order Iteration Func-count f(x) step optimality CG-iterations x(1)=1.000000+0.000000i x(2)=1.000000+0.000000i x(3)=1.000000+0.000000i 0 4 267.268 89.2 x(1)=1.000000+0.000000i x(2)=1.000000+0.000000i x(3)=1.000000+0.000000i 1 8 267.268 7.26736 89.2 0 x(1)=0.588062+0.400105i x(2)=0.223569+0.191305i x(3)=-0.158092+-0.995244i 2 12 73.6223 1.81684 13.8 0 x(1)=1.914850+-0.478769i x(2)=-0.760707+1.025506i x(3)=-2.589293+-2.754627i 3 16 24.8735 3.63368 36.1 0 x(1)=1.473642+-0.017474i x(2)=-0.533834+1.507987i x(3)=-2.481998+-3.272860i 4 20 0.30956 0.985798 2.03 0 x(1)=1.513119+-0.047554i x(2)=-0.438356+1.425158i x(3)=-2.617916+-3.192791i 5 24 0.000498233 0.208146 0.126 0 x(1)=1.514985+-0.047818i x(2)=-0.436067+1.426855i x(3)=-2.617734+-3.195948i 6 28 1.45562e-010 0.00465524 7.53e-005 0 x(1)=1.514984+-0.047818i x(2)=-0.436070+1.426856i x(3)=-2.617733+-3.195949i 7 32 2.43937e-023 3.0415e-006 1.52e-011 0 Equation solved. fsolve completed because the vector of function values is near zero as measured by the default value of the function tolerance, and the problem appears regular as measured by the gradient. xlast = 1.514983763593827 - 0.047817849126132i -0.436069706071287 + 1.426855556443150i -2.617733027757387 - 3.195948930097455i |

金蟲 (初入文壇)
榮譽(yù)版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗(yàn): +2 |

木蟲 (正式寫手)
| 7 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 0703化學(xué)調(diào)劑 +3 | pupcoco 2026-03-17 | 6/300 |
|
|---|---|---|---|---|
|
[考研] 298-一志愿中國(guó)農(nóng)業(yè)大學(xué)-求調(diào)劑 +4 | 手機(jī)用戶 2026-03-17 | 4/200 |
|
|
[考研] 268求調(diào)劑 +6 | 簡(jiǎn)單點(diǎn)0 2026-03-17 | 6/300 |
|
|
[考研] 085601材料工程專碩求調(diào)劑 +5 | 慕寒mio 2026-03-16 | 5/250 |
|
|
[考研] 268求調(diào)劑 +7 | 好運(yùn)連綿不絕 2026-03-12 | 8/400 |
|
|
[考研] 308求調(diào)劑 +4 | 是Lupa啊 2026-03-16 | 4/200 |
|
|
[考研] 一志愿,福州大學(xué)材料專碩339分求調(diào)劑 +3 | 木子momo青爭(zhēng) 2026-03-15 | 3/150 |
|
|
[考研] 274求調(diào)劑 +5 | 時(shí)間點(diǎn) 2026-03-13 | 5/250 |
|
|
[考研] 機(jī)械專碩325,尋找調(diào)劑院校 +3 | y9999 2026-03-15 | 5/250 |
|
|
[考研] 304求調(diào)劑 +5 | 素年祭語(yǔ) 2026-03-15 | 5/250 |
|
|
[考研] 080500,材料學(xué)碩302分求調(diào)劑學(xué)校 +4 | 初識(shí)可樂(lè) 2026-03-14 | 5/250 |
|
|
[考研] 331求調(diào)劑(0703有機(jī)化學(xué) +5 | ZY-05 2026-03-13 | 6/300 |
|
|
[考研] 學(xué)碩285求調(diào)劑 +13 | Wisjxn 2026-03-12 | 46/2300 |
|
|
[考研] 308求調(diào)劑 +5 | 是Lupa啊 2026-03-11 | 5/250 |
|
|
[考研] 材料工程調(diào)劑 +9 | 咪咪空空 2026-03-12 | 9/450 |
|
|
[考研] 0856材料與化工301求調(diào)劑 +5 | 奕束光 2026-03-13 | 5/250 |
|
|
[考研] 一志愿西南交大,材料專碩317求調(diào)劑 +5 | lx8568 2026-03-11 | 5/250 |
|
|
[考研] 315求調(diào)劑 +9 | 小羊小羊_ 2026-03-11 | 10/500 |
|
|
[考研] 求調(diào)劑 +5 | 一定有學(xué)上- 2026-03-12 | 5/250 |
|
|
[考研] 0817化學(xué)工程與技術(shù)考研312分調(diào)劑 +3 | T123 tt 2026-03-12 | 3/150 |
|