MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] matlab 使用lsqcurvefit函数出错 望好心人指教 (https://www.labfans.com/bbs/showthread.php?t=13866)

whitecat198 2011-09-07 09:08

matlab 使用lsqcurvefit函数出错 望好心人指教
 
小弟想使用lsqcurvefit求y=(x/a)^(1/b)+c中的abc三个参数,使用以下方法计算:
m函数:
function y=myfun(a,x)
y=(x/a(1))^(1/a(2))+a(3);
程序:
>> x=[0 5.555556 20 40 60 80 100 120 140 160 180 200];
y=[0.36036 0.61982 0.918919 1.16036 1.340541 1.506306 1.654054 1.783784 1.913514 2.025225 2.140541 2.255856];
x0=[1,1,1];
[x,resnorm]=lsqcurvefit(@myfun,x0,x,y)
程序提示出错:
??? Error using ==> mpower
Matrix must be square.

Error in ==> myfun at 2
F=(x/a(1))^(1/a(2))+a(3);

Error in ==> lsqcurvefit at 209
initVals.F = feval(funfcn_x_xdata{3},xCurrent,XDATA,varargin{:});

Caused by:
Failure in initial user-supplied objective function evaluation. LSQCURVEFIT cannot continue
希望好心人帮忙看看,程序错在什么地方或则有其他什么方法可以计算,谢谢


所有时间均为北京时间。现在的时间是 12:43

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