matlab中lsqcurvefit函数拟合问题,有懂的请帮下忙,M文件:function f= fun(c,x)f= ((c(1)+c(2)*x+x.^2)-((c(1)+c(2)*x.^2).^2-4*x.^2).^0.5)/(2*x.^2)在窗口中输入的文件:b=[3.5026 4.2031 4.9035 5.604 6.3045 7.005 2.2378 2.6852 3.1328

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/06 04:32:08
matlab中lsqcurvefit函数拟合问题,有懂的请帮下忙,M文件:function f= fun(c,x)f= ((c(1)+c(2)*x+x.^2)-((c(1)+c(2)*x.^2).^2-4*x.^2).^0.5)/(2*x.^2)在窗口中输入的文件:b=[3.5026 4.2031 4.9035 5.604 6.3045 7.005 2.2378 2.6852 3.1328

matlab中lsqcurvefit函数拟合问题,有懂的请帮下忙,M文件:function f= fun(c,x)f= ((c(1)+c(2)*x+x.^2)-((c(1)+c(2)*x.^2).^2-4*x.^2).^0.5)/(2*x.^2)在窗口中输入的文件:b=[3.5026 4.2031 4.9035 5.604 6.3045 7.005 2.2378 2.6852 3.1328
matlab中lsqcurvefit函数拟合问题,有懂的请帮下忙,
M文件:
function f= fun(c,x)
f= ((c(1)+c(2)*x+x.^2)-((c(1)+c(2)*x.^2).^2-4*x.^2).^0.5)/(2*x.^2)
在窗口中输入的文件:
b=[3.5026 4.2031 4.9035 5.604 6.3045 7.005 2.2378 2.6852 3.1328 3.5803 4.0278 4.4753;0.07331 0.0523 0.03932 0.0306 0.02446 0.01982 0.18063 0.12797 0.0954 0.07374 0.05875 0.04788];
a=b';
x=a(:,1);
y=a(:,2);
c0=[1,1]';
[c,resnorm]=lsqcurvefit(@fun,c0,x,y)
运行后:
Error using ==> d:/matlab6p5/toolbox/optim/private/lsqncommon
Function value and YDATA sizes are incommensurate.
Error in ==> D:\MATLAB6p5\toolbox\optim\lsqcurvefit.m
On line 129 ==> [x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...

matlab中lsqcurvefit函数拟合问题,有懂的请帮下忙,M文件:function f= fun(c,x)f= ((c(1)+c(2)*x+x.^2)-((c(1)+c(2)*x.^2).^2-4*x.^2).^0.5)/(2*x.^2)在窗口中输入的文件:b=[3.5026 4.2031 4.9035 5.604 6.3045 7.005 2.2378 2.6852 3.1328
function f= fun(c,x)
f= ((c(1)+c(2).*x+x.^2)-((c(1)+c(2).*x.^2).^2-4*x.^2).^0.5)./(2*x.^2)
b=[3.5026 4.2031 4.9035 5.604 6.3045 7.005 2.2378 2.6852 3.1328 3.5803 4.0278 4.4753;
0.07331 0.0523 0.03932 0.0306 0.02446 0.01982 0.18063 0.12797 0.0954 0.07374 0.05875 0.04788];
a=b';
x=a(:,1);
y=a(:,2);
c0=[1 1]';
[c,resnorm]=lsqcurvefit(@fun,c0,x,y)