MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   matlab函数定义问题求教 (https://www.labfans.com/bbs/showthread.php?t=6350)

realyw 2009-02-07 10:01

matlab函数定义问题求教
 
如下一个程序,其中a和b为需要估计的两个参数,x为数据已经输入。
function fun=myfun(para,x)
a=para(1);
b=para(2);
u=0.02;
f=1/b*(1+a*(x-u)/b).^(-1/a-1)
fun=-sum(log(f));

%---------------------estimation
[para,fv]=fminsearch(fun,[0.2;0.01],[],x);

程序运行结果显示错误信息:
??? Input argument "para" is undefined.

Error in ==> myfun at 2
a=para(1);

请教高手这是怎么回事?应该如何定义函数?


所有时间均为北京时间。现在的时间是 03:27

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.