matlab lsqcurvefit函数function T = nihehanshu( x,xdata )T = 1./(x(1)*xdata + repmat(x(2),1,10) ) + repmat(x(3),1,10) ;end>> xdata = [82 38 19.8 12.9 8.5 6.1 3.7 2.5 1.73 1.14];>> ydata = [-18 -8 5 16 25 33 46 55 66 80];>> x0 = [0,0,0];>> [x,resnorm

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 21:59:01
matlab lsqcurvefit函数function T = nihehanshu( x,xdata )T = 1./(x(1)*xdata + repmat(x(2),1,10) ) + repmat(x(3),1,10) ;end>> xdata = [82 38 19.8 12.9 8.5 6.1 3.7 2.5 1.73 1.14];>> ydata = [-18 -8 5 16 25 33 46 55 66 80];>> x0 = [0,0,0];>> [x,resnorm

matlab lsqcurvefit函数function T = nihehanshu( x,xdata )T = 1./(x(1)*xdata + repmat(x(2),1,10) ) + repmat(x(3),1,10) ;end>> xdata = [82 38 19.8 12.9 8.5 6.1 3.7 2.5 1.73 1.14];>> ydata = [-18 -8 5 16 25 33 46 55 66 80];>> x0 = [0,0,0];>> [x,resnorm
matlab lsqcurvefit函数
function T = nihehanshu( x,xdata )
T = 1./(x(1)*xdata + repmat(x(2),1,10) ) + repmat(x(3),1,10) ;
end
>> xdata = [82 38 19.8 12.9 8.5 6.1 3.7 2.5 1.73 1.14];
>> ydata = [-18 -8 5 16 25 33 46 55 66 80];
>> x0 = [0,0,0];
>> [x,resnorm] = [@nihehanshu,x0,xdata,ydata]
Error using ==> horzcat
The following error occurred converting from double to function_handle:
Error using ==> function_handle
Too many output arguments.
x0改成 x0 = [1,1,1];

matlab lsqcurvefit函数function T = nihehanshu( x,xdata )T = 1./(x(1)*xdata + repmat(x(2),1,10) ) + repmat(x(3),1,10) ;end>> xdata = [82 38 19.8 12.9 8.5 6.1 3.7 2.5 1.73 1.14];>> ydata = [-18 -8 5 16 25 33 46 55 66 80];>> x0 = [0,0,0];>> [x,resnorm
你用的是什么版本的matlab?
确定是这种用法么?
[x,resnorm] = [@nihehanshu,x0,xdata,ydata]
这句显然不对啊,你用的什么工具箱都没体现出来,怎么算.
我的是R2006a
改成[x,resnorm] = lsqcurvefit(@nihehanshu,x0,xdata,ydata)
就可以运行了
建议用工具箱之前先help一下用法以后