声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1687|回复: 2

[综合讨论] 请教高手如何算带两参数的非线性方程。

[复制链接]
发表于 2007-1-22 21:18 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
function F = myfun(x,a)
        F = 2*x(1)-x(2)-exp(a*x(1))-x(1) + 2*x(2)-exp(a*x(2));


a=-1;
x = fsolve(@(x) myfun(x,a),[-5,-5])
Warning: Default trust-region dogleg method of FSOLVE cannot
handle non-square systems; switching to Gauss-Newton method.
> In fsolve at 232
Conditioning of Gradient Poor - Switching To LM method
Optimization terminated: directional derivative along
search direction less than TolFun and infinity-norm of
gradient less than 10*(TolFun+TolX).
x =
    0.5671    0.5671

错在哪里,请教高手如何算带两参数的非线性方程。在线等。

[ 本帖最后由 kapuliyuehan 于 2007-1-22 21:21 编辑 ]
回复
分享到:

使用道具 举报

发表于 2007-1-26 16:29 | 显示全部楼层
发表于 2007-1-26 19:24 | 显示全部楼层
x0=[-5;-5]
x0 =
    -5
    -5
>> options=optimset('Display','iter')
options =
                   Display: 'iter'
               MaxFunEvals: []
                   MaxIter: []
                    TolFun: []
                      TolX: []
               FunValCheck: []
                 OutputFcn: []
           ActiveConstrTol: []
        NoStopIfFlatInfeas: []
            BranchStrategy: []
           DerivativeCheck: []
               Diagnostics: []
             DiffMaxChange: []
             DiffMinChange: []
         GoalsExactAchieve: []
                GradConstr: []
                   GradObj: []
                   Hessian: []
                  HessMult: []
               HessPattern: []
                HessUpdate: []
           InitialHessType: []
         InitialHessMatrix: []
                  Jacobian: []
                 JacobMult: []
              JacobPattern: []
                LargeScale: []
        LevenbergMarquardt: []
            LineSearchType: []
                  MaxNodes: []
                MaxPCGIter: []
                MaxRLPIter: []
                MaxSQPIter: []
                   MaxTime: []
             MeritFunction: []
                 MinAbsMax: []
       NodeDisplayInterval: []
        NodeSearchStrategy: []
          NonlEqnAlgorithm: []
      PhaseOneTotalScaling: []
            Preconditioner: []
          PrecondBandWidth: []
            RelLineSrchBnd: []
    RelLineSrchBndDuration: []
          ShowStatusWindow: []
                   Simplex: []
                    TolCon: []
                    TolPCG: []
                 TolRLPFun: []
               TolXInteger: []
                  TypicalX: []
>> [x,fval]=fsolve(@myfun_eq1,x0,options,-1)
Warning: Default trust-region dogleg method of FSOLVE cannot
handle non-square systems; switching to Gauss-Newton method.
> In fsolve at 232
                                                     Directional
Iteration  Func-count    Residual     Step-size      derivative
     0           3         94142.4
     1          12        0.539601         5.69            4.34
Conditioning of Gradient Poor - Switching To LM method
     2          18    4.73984e-007         1.07        -0.00098            0.5
     3          24    1.22382e-025         1.05      -4.59e-016       0.240855
     4          25     6.5685e-029            1      -2.39e-025       0.117548
Optimization terminated: directional derivative along
search direction less than TolFun and infinity-norm of
gradient less than 10*(TolFun+TolX).
x =
    0.5671
    0.5671

fval =
  8.1046e-015
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-21 18:49 , Processed in 0.058934 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表