Matlab拟合出错
clcx1=[0.050.0750.10.20.40.60.20.20.20.20.20.2]';x2=[54500054500054500054500054500054...
clc
x1=[0.050.0750.10.20.40.60.20.20.20.20.20.2]';
x2=[54500054500054500054500054500054500054545.45181818.18363636.36909090.911454545.452181818.18]';
x=[x1,x2];
y=[769.9144325.0511174.300139.85486.9964032.46029142.524240.856139.854839.687839.64139.6194]';
fun=inline('1.445*1.225*x(:,1).^a(1)*x(:,2).^a(2)*(x(:,1)-1).^2','a','x');
a=lsqcurvefit(fun,[0 0],x,y)
提示错误信息为:
??? Error using ==> optim\private\lsqncommon
User supplied expression or inline function ==> 1.445*1.225*x(:,1).^a(1)*x(:,2).^a(2)*(x(:,1)-1).^2
failed with the following error:
Error using ==> inlineeval
Error in inline expression ==> 1.445*1.225*x(:,1).^a(1)*x(:,2).^a(2)*(x(:,1)-1).^2
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> lsqcurvefit at 149
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
Error in ==> curvefitting at 7
a=lsqcurvefit(fun,[1 1],x,y)
>>
新手刚刚接触,查好久都没查到哪里的问题,跪求大虾出手看看哪里有问题,感激不尽!!! 展开
x1=[0.050.0750.10.20.40.60.20.20.20.20.20.2]';
x2=[54500054500054500054500054500054500054545.45181818.18363636.36909090.911454545.452181818.18]';
x=[x1,x2];
y=[769.9144325.0511174.300139.85486.9964032.46029142.524240.856139.854839.687839.64139.6194]';
fun=inline('1.445*1.225*x(:,1).^a(1)*x(:,2).^a(2)*(x(:,1)-1).^2','a','x');
a=lsqcurvefit(fun,[0 0],x,y)
提示错误信息为:
??? Error using ==> optim\private\lsqncommon
User supplied expression or inline function ==> 1.445*1.225*x(:,1).^a(1)*x(:,2).^a(2)*(x(:,1)-1).^2
failed with the following error:
Error using ==> inlineeval
Error in inline expression ==> 1.445*1.225*x(:,1).^a(1)*x(:,2).^a(2)*(x(:,1)-1).^2
??? Error using ==> mtimes
Inner matrix dimensions must agree.
Error in ==> lsqcurvefit at 149
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
Error in ==> curvefitting at 7
a=lsqcurvefit(fun,[1 1],x,y)
>>
新手刚刚接触,查好久都没查到哪里的问题,跪求大虾出手看看哪里有问题,感激不尽!!! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询