matlab 序列 次大值,matlab请问怎么设置fsolve函数的最大迭代次数,Maxfuneval,谢谢 - 程序语言 - 小木虫 - 学术 科研 互动社区...

cfdc6361174d9cfc8169daed13483a0c.gif

月只蓝

options=optimset('Maxfuneval',1000);   %修改为1000次CODE:

function solve_eqs

clear all;clc

options=optimset('Maxfuneval',1000);

global m;

m=0.01;

for i=1:51

[y fval]=fsolve(@myf02,[0.004,0.7,1.2],options);

n(1:3,i)=y;

nn(1:3,i)=fval;

m=m+0.02;

end

n

nn

function f=myf02(x)

global m;

f(1)=7.935516634*m^3*x(3)^3-x(1)^2*x(2)^2;

f(2)=-0.12*m-0.0003*x(1)-0.011285-log10(x(2));

f(3)=0.14*m-0.024*x(1)+0.027595-log10(x(3));

解和残差:

n =

Columns 1 through 13

0.0032    0.0172    0.0368    0.0618    0.0913    0.1249    0.1624    0.2036    0.2485    0.2970    0.3489    0.4041    0.4628

0.9717    0.9663    0.9610    0.9556    0.9504    0.9451    0.9399    0.9347    0.9295    0.9243    0.9192    0.9141    0.9090

1.0689    1.0749    1.0807    1.0862    1.0915    1.0965    1.1013    1.1059    1.1103    1.1145    1.1185    1.1223    1.1259

Columns 14 through 26

0.5247    0.5898    0.6581    0.7296    0.8042    0.8818    0.9625    1.0461    1.1327    1.2222    1.3146    1.4097    1.5076

0.9040    0.8990    0.8940    0.8890    0.8840    0.8791    0.8742    0.8694    0.8645    0.8597    0.8549    0.8501    0.8454

1.1293    1.1325    1.1355    1.1384    1.1410    1.1435    1.1458    1.1479    1.1498    1.1515    1.1530    1.1544    1.1556

Columns 27 through 39

1.6083    1.7116    1.8176    1.9261    2.0372    2.1508    2.2668    2.3852    2.5060    2.6290    2.7543    2.8819    3.0115

0.8407    0.8360    0.8313    0.8267    0.8221    0.8175    0.8129    0.8083    0.8038    0.7993    0.7949    0.7904    0.7860

1.1566    1.1575    1.1582    1.1587    1.1591    1.1592    1.1593    1.1592    1.1589    1.1585    1.1580    1.1573    1.1564

Columns 40 through 51

3.1433    3.2772    3.4130    3.5508    3.6906    3.8321    3.9756    4.1208    4.2677    4.4163    4.5666    4.7184

0.7816    0.7772    0.7728    0.7685    0.7642    0.7599    0.7557    0.7514    0.7472    0.7430    0.7388    0.7347

1.1555    1.1544    1.1531    1.1518    1.1503    1.1487    1.1470    1.1452    1.1433    1.1413    1.1392    1.1370

残差:

nn =

1.0e-005 *

Columns 1 through 13

-0.0001   -0.8662   -0.0512   -0.0349   -0.0142   -0.0356   -0.0006   -0.1149   -0.0005   -0.0000   -0.0572   -0.0000   -0.0000

0.0197    0.0000   -0.0000    0.0000    0.0076    0.0065    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

0.0000    0.0006    0.0000    0.0009    0.0406    0.0306    0.0000    0.0001    0.0000    0.0000    0.0001    0.0000    0.0000

Columns 14 through 26

-0.0447   -0.0000   -0.0000   -0.0003   -0.0005   -0.0005   -0.0002   -0.0001   -0.0000   -0.0000    0.0000   -0.0000   -0.0000

0.0000   -0.0000   -0.0000    0.0000    0.0000    0.0000   -0.0000   -0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

0.0012    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

Columns 27 through 39

-0.0000   -0.0000   -0.0000   -0.0000   -0.0000   -0.0000    0.0003    0.0005    0.0009    0.0013    0.0000    0.0000    0.0000

0.0000    0.0000    0.0000    0.0000    0.0000   -0.0000   -0.0000   -0.0000    0.0000   -0.0000   -0.0000    0.0000   -0.0000

0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

Columns 40 through 51

0.0000   -0.0000   -0.0000    0.0005    0.0005    0.0008    0.0000    0.0000    0.0000    0.0000   -0.0002    0.0000

-0.0000    0.0000    0.0000   -0.0000    0.0000   -0.0000         0    0.0000         0    0.0000    0.0000   -0.0000

0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000

9fec42295304f0dec2a3e6ee874b6039.png

qq642867921

引用回帖:

月只蓝 at 2015-09-25 12:14:07

options=optimset('Maxfuneval',1000);   %修改为1000次

function solve_eqs

clear all;clc

options=optimset('Maxfuneval',1000);

global m;

m=0.01;

for i=1:51

=fsolve(@myf02,,options);

...

挺谢谢你的。假如我把f(1)=7.935516634*m^3*x(3)^3-x(1)^2*x(2)^2;里面的7.935516634换成154065137.1这么大的数字,它不管怎么都计算不了,需要怎么弄呢?谢谢!

cfdc6361174d9cfc8169daed13483a0c.gif

月只蓝

引用回帖:

qq642867921 at 2015-09-25 13:20:44

挺谢谢你的。假如我把f(1)=7.935516634*m^3*x(3)^3-x(1)^2*x(2)^2;里面的7.935516634换成154065137.1这么大的数字,它不管怎么都计算不了,需要怎么弄呢?谢谢!...

我没有遇到你说的不能计算的问题,你最好把问题的详情以截图的形式给出。以下代码运行正常,结果也正常。

function solve_eqs

clear all;clc

options=optimset('Maxfuneval',1000);

global m;

m=0.01;

for i=1:51

[y fval]=fsolve(@myf02,[0.004,0.7,1.2],options);

n(1:3,i)=y;

nn(1:3,i)=fval;

m=m+0.02;

end

n

nn

function f=myf02(x)

global m;

f(1)=154065137.1*m^3*x(3)^3-x(1)^2*x(2)^2;

f(2)=-0.12*m-0.0003*x(1)-0.011285-log10(x(2));

f(3)=0.14*m-0.024*x(1)+0.027595-log10(x(3));

计算结果:

n =

Columns 1 through 14

7.5752   17.5715   23.5271   27.8150   31.1919   33.9926   36.3950   38.5054   40.3923   42.1023   43.6690   45.1171   46.4653   47.7283

0.9666    0.9546    0.9455    0.9375    0.9302    0.9232    0.9166    0.9103    0.9041    0.8980    0.8921    0.8863    0.8806    0.8750

0.7034    0.4075    0.2951    0.2343    0.1957    0.1687    0.1487    0.1332    0.1208    0.1106    0.1021    0.0948    0.0886    0.0832

Columns 15 through 28

48.9177   50.0429   51.1115   52.1301   53.1038   54.0373   54.9345   55.7986   56.6326   57.4389   58.2199   58.9775   59.7135   60.4293

0.8694    0.8640    0.8586    0.8532    0.8480    0.8428    0.8376    0.8325    0.8274    0.8224    0.8174    0.8125    0.8076    0.8028

0.0784    0.0741    0.0703    0.0669    0.0638    0.0610    0.0584    0.0561    0.0539    0.0519    0.0500    0.0483    0.0466    0.0451

Columns 29 through 42

61.1264   61.8061   62.4694   63.1174   63.7510   64.3712   64.9785   65.5739   66.1578   66.7309   67.2938   67.8470   68.3910   68.9261

0.7980    0.7932    0.7885    0.7838    0.7791    0.7745    0.7699    0.7653    0.7608    0.7563    0.7518    0.7474    0.7430    0.7386

0.0437    0.0423    0.0411    0.0399    0.0388    0.0377    0.0367    0.0357    0.0348    0.0340    0.0331    0.0323    0.0316    0.0309

Columns 43 through 51

69.4529   69.9716   70.4827   70.9865   71.4832   71.9732   72.4568   72.9342   73.4057

0.7343    0.7300    0.7257    0.7215    0.7172    0.7131    0.7089    0.7047    0.7006

0.0302    0.0295    0.0289    0.0283    0.0277    0.0271    0.0266    0.0260    0.0255

nn =

1.0e-009 *

Columns 1 through 14

0.6237    0.0001   -0.1888         0    0.0059    0.0005    0.0023   -0.0005    0.0002    0.0005    0.0111         0    0.0005   -0.0005

0.0000    0.0000    0.0000   -0.0000   -0.0000    0.0000    0.0000   -0.0000         0    0.0000    0.0000    0.0000    0.0000    0.0000

0.0018         0    0.0000   -0.0000    0.0000    0.0000    0.0000         0    0.0000         0    0.0000         0         0   -0.0000

Columns 15 through 28

0.0002    0.0030    0.0009    0.0002         0    0.0009    0.0009   -0.0005    0.0005    0.0009    0.0064   -0.0005    0.0005         0

0.0000    0.0000    0.0000         0   -0.0000   -0.0000    0.0000         0   -0.0000    0.0000         0   -0.0000    0.0000   -0.0000

0         0    0.0000   -0.0000         0         0   -0.0000   -0.0000    0.0000         0    0.0000    0.0000   -0.0000         0

Columns 29 through 42

-0.0005         0    0.0014         0    0.0009         0         0    0.0009    0.0041    0.0009         0    0.0005   -0.0014   -0.0005

-0.0000   -0.0000    0.0000    0.0000         0   -0.0000   -0.0000   -0.0000    0.0000   -0.0000   -0.0000    0.0000         0    0.0000

0.0000   -0.0000   -0.0000   -0.0000         0    0.0000   -0.0000    0.0000    0.0000    0.0000         0         0   -0.0000   -0.0000

Columns 43 through 51

0.0009    0.0005    0.0009         0   -0.0005         0   -0.0009    0.0005   -0.0009

0.0000    0.0000         0   -0.0000         0    0.0000   -0.0000    0.0000   -0.0000

0.0000         0    0.0000   -0.0000   -0.0000    0.0000    0.0000         0    0.0000

9fec42295304f0dec2a3e6ee874b6039.png

qq642867921

引用回帖:

月只蓝 at 2015-09-25 14:01:06

我没有遇到你说的不能计算的问题,你最好把问题的详情以截图的形式给出。以下代码运行正常,结果也正常。

function solve_eqs

clear all;clc

options=optimset('Maxfuneval',1000);

global m;

m=0.01;

for ...

我没学过matlab,感觉用起来好烦。希望你能帮到我。真心感谢!

bw244h3860444_1443323521_852.png

QQ截图20150927111109.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值