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/07/08 13:37:06
![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](/uploads/image/z/3933446-14-6.jpg?t=matlab+lsqcurvefit%E5%87%BD%E6%95%B0function+T+%3D+nihehanshu%28+x%2Cxdata+%29T+%3D+1.%2F%28x%281%29%2Axdata+%2B+repmat%28x%282%29%2C1%2C10%29+%29+%2B+repmat%28x%283%29%2C1%2C10%29+%3Bend%3E%3E+xdata+%3D+%5B82+38+19.8+12.9+8.5+6.1+3.7+2.5+1.73+1.14%5D%3B%3E%3E+ydata+%3D+%5B-18+-8+5+16+25+33+46+55+66+80%5D%3B%3E%3E+x0+%3D+%5B0%2C0%2C0%5D%3B%3E%3E+%5Bx%2Cresnorm)
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一下用法以后