Matlab 版 (精华区)

发信人: seesea (马虎学究), 信区: Matlab
标  题: [合集]关于fsolve的一个问题
发信站: 哈工大紫丁香 (2003年01月22日21:23:48 星期三), 站内信件


────────────────────────────────────────
 flyhj (robust)                       于 Thu Jan 16 09:21:29 2003) 说道:

以下这段程序是我从帮助文件中拷贝焉的,运行的时候出错说“Input argument 'x' is 
undefined.”是什么原因,谢谢!


function F = myfun(x)
F = [2*x(1) - x(2) - exp(-x(1));
      -x(1) + 2*x(2) - exp(-x(2))];
% Next, call an optimization routine.

x0 = [-5; -5];           % Make a starting guess at the solution
options=optimset('Display','iter');   % Option to display output
[x,fval] = fsolve(@myfun,x0,options)  % Call optimizer


────────────────────────────────────────
 zjliu (秋天的萝卜)                   于 2003年01月16日10:13:53 星期四 说道:

这样写程序,并把文件名存成ppzz.m 就行了
function [x,fval]=ppzz;
x0 = [-5; -5];           % Make a starting guess at the solution
options=optimset('Display','iter');   % Option to display output
[x,fval] = fsolve(@myfun,x0,options)  % Call optimizer
function F = myfun(x)
F = [2*x(1) - x(2) - exp(-x(1));
      -x(1) + 2*x(2) - exp(-x(2))];
% Next, call an optimization routine.
【 在 flyhj (robust) 的大作中提到: 】
: 以下这段程序是我从帮助文件中拷贝焉的,运行的时候出错说“Input argument 'x' is 
: undefined.”是什么原因,谢谢!


: function F = myfun(x)
: F = [2*x(1) - x(2) - exp(-x(1));
:       -x(1) + 2*x(2) - exp(-x(2))];
: % Next, call an optimization routine.

: x0 = [-5; -5];           % Make a starting guess at the solution
: options=optimset('Display','iter');   % Option to display output

────────────────────────────────────────
 flyhj (robust)                       于 Thu Jan 16 10:16:16 2003) 说道:

Thanks!
【 在 zjliu (秋天的萝卜) 的大作中提到: 】
: 这样写程序,并把文件名存成ppzz.m 就行了
: function [x,fval]=ppzz;
: x0 = [-5; -5];           % Make a starting guess at the solution
: options=optimset('Display','iter');   % Option to display output
: [x,fval] = fsolve(@myfun,x0,options)  % Call optimizer
: function F = myfun(x)
: F = [2*x(1) - x(2) - exp(-x(1));
:       -x(1) + 2*x(2) - exp(-x(2))];
: % Next, call an optimization routine.
: 【 在 flyhj (robust) 的大作中提到: 】
: : 以下这段程序是我从帮助文件中拷贝焉的,运行的时候出错说“Input argument  ..

: : undefined.”是什么原因,谢谢!
: : 
: : 
: : function F = myfun(x)
: : F = [2*x(1) - x(2) - exp(-x(1));
: :       -x(1) + 2*x(2) - exp(-x(2))];
: : % Next, call an optimization routine.
: : 
: : x0 = [-5; -5];           % Make a starting guess at the solution
: : options=optimset('Display','iter');   % Option to display output



────────────────────────────────────────
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:7.315毫秒