2008057 发表于 2010-3-11 09:44

关于fsolve函数的用法

function g =funmy11(a)
fa1 = @(x)x.*exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
fa2 = @(x)exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
f1 =quadl(fa1,50.45,50.57)/quadl(fa2,50.45,50.57)-50.5295;
fb1 =@(x)x.^2.*exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
fb2 =@(x)exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
f2 =quadl(fb1,50.45,50.57)/quadl(fb2,50.45,50.57)-2.5532e+003;
fc1 =@(x)x.^3.*exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
fc2 =@(x)exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
f3 =quadl(fc1,50.45,50.57)/quadl(fc2,50.45,50.57)-1.2901e+005;
g =;
%%%%%%%%%%%%%%%%%%%
a0=;
options =optimset('Display','off');
=fsolve(@funmy11,a0,options)

Warning: Infinite or Not-a-Number function value encountered.
> In quadl at 101
In funmy11 at 4
In fsolve at 180
In aac at 3
Warning: Infinite or Not-a-Number function value encountered.
> In quadl at 101
In funmy11 at 7
In fsolve at 180
In aac at 3
Warning: Infinite or Not-a-Number function value encountered.
> In quadl at 101
In funmy11 at 10
In fsolve at 180
In aac at 3
...

a =
   1   1   0

fval =
   NaN
   NaN
   NaN
>>请高手帮忙看下,什么问题啊,我看不明白,用这个方法解别的问题可以,但是只要一换数就不行了,数太大或太小都不能求解,我该怎么设置参数呢,请指教

[ 本帖最后由 ChaChing 于 2010-3-11 11:32 编辑 ]

2008057 发表于 2010-3-14 20:26

求助,解非线性方程组

function g =funp1(a);
fa1=@(x)x.*exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
fa2=@(x)exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
f1 =quad(fa1,-0.025,-0.026)/quad(fa2,-0.025,-0.026)+0.0257;
fb1 =@(x)x.^2.*exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
fb2 =@(x)exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
f2 =quad(fb1,-0.025,-0.026)/quad(fb2,-0.025,-0.026)-0.00066058;
fc1=@(x)x.^3.*exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
fc2 =@(x)exp(a(1).*x+a(2).*x.^2+a(3).*x.^3);
f3 =quad(fc1,-0.025,-0.026)/quad(fc2,-0.025,-0.026)+0.00001698;
g =;


a0 =[-0.1,0.1,0];
options =optimset('Display','iter','MaxFunEvals',400);
= fsolve(@funp1,a0,options)
Optimization terminated: first-order optimality is less than options.TolFun.
a =
   0   0   0

fval =
1.0e-003 *
    0.2000
   -0.0102
    0.0004

elitecn 发表于 2010-3-20 11:16

我在百度知道经常发现有些提问者,他们希望别人花很多时间和精力帮他们解答问题,可是自己却懒得多打几个字把提的问题稍微详细描述下。

2008057 发表于 2010-3-20 18:18

回复 板凳 elitecn 的帖子

问题已经很清楚了,程序都在,怎么说我描述不够详细呢,还是您懒得看呢
页: [1]
查看完整版本: 关于fsolve函数的用法