| 查看: 3085 | 回复: 6 | ||||
cq0932金虫 (初入文坛)
|
[求助]
求教fsolve如何查看每次迭代的x值?
|
|
利用fsolve可以求解非线性方程的数值解,但是只有最后的结果,没有每步迭代的x取值。 在求解之前设置迭代显示的选项 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 输出结果只有f(x)的值,请问如何设置才能看到每步迭代的x取值? |
» 收录本帖的淘帖专辑推荐
matlab典型案例 |
» 猜你喜欢
体制内长辈说体制内绝大部分一辈子在底层,如同你们一样大部分普通教师忙且收入低
已经有10人回复
过年走亲戚时感受到了所开私家车的鄙视链
已经有9人回复
今年春晚有几个节目很不错,点赞!
已经有10人回复
情人节自我反思:在爱情中有过遗憾吗?
已经有10人回复
基金正文30页指的是报告正文还是整个申请书
已经有5人回复
» 本主题相关价值贴推荐,对您同样有帮助:
求助,方程组求解出数值解后,第一个解是下个循环的一个参数
已经有1人回复
求助,方程组求解出数值解后,第一个解是下个循环的一个参数
已经有0人回复
曲线的光滑连接-插值求教
已经有4人回复

2楼2012-11-22 16:17:23
【答案】应助回帖
★ ★
xiegangmai: 金币+2, 谢谢参与 2012-11-24 19:45:25
xiegangmai: 金币+2, 谢谢参与 2012-11-24 19:45:25
|
这样行不,x有3个的,复数输出如下 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 |

3楼2012-11-22 17:01:14
cq0932
金虫 (初入文坛)
- 应助: 1 (幼儿园)
- 金币: 734.8
- 帖子: 44
- 在线: 20.2小时
- 虫号: 965611
- 注册: 2010-03-09
- 性别: GG
- 专业: 机械测试理论与技术
4楼2012-11-24 15:41:32
5楼2012-11-25 01:02:09

6楼2012-11-26 11:09:52
szuwusongbin
木虫 (正式写手)
- 应助: 0 (幼儿园)
- 金币: 3115.4
- 散金: 10
- 红花: 2
- 帖子: 410
- 在线: 152.8小时
- 虫号: 3130374
- 注册: 2014-04-12
- 性别: GG
- 专业: 概率论与随机分析
7楼2016-01-28 00:17:39













回复此楼
