matlab进行复杂函数的拟合!!急急
以下市我的程序:clearall;f=@(p,t)(p(1)+(2*p(2)/pi)*(p(3)/(4*(t-p(4))^2+p(3)^2)));t=[844.18484...
以下市我的程序:
clear all;
f=@(p,t)(p(1)+(2*p(2)/pi)*(p(3)/(4*(t-p(4))^2+p(3)^2)));
t=[844.184 844.282 844.38 844.477 844.575 844.673 844.771 844.868 844.966 845.064];
x=[0.001035789 0.001436904 0.001364923 0.002225498 0.003208845 0.003747225 0.002493808 0.001551733 0.001103887 0.000977157
];
opt=optimset('display','off');
x0=[7,0.0015,0.3,850];
for ii=1:100
x=lsqcurvefit(f,x0,t,x,[],[],opt);
x0=x;
end
cc=corrcoef(t,f(p,t));
运行结果是:??? Error using ==> lsqncommon at 101
LSQCURVEFIT cannot continue because user supplied objective function failed with the
following error:
Error using ==> mpower
Matrix must be square.
Error in ==> lsqcurvefit at 186
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
我想拟合洛伦兹线性 展开
clear all;
f=@(p,t)(p(1)+(2*p(2)/pi)*(p(3)/(4*(t-p(4))^2+p(3)^2)));
t=[844.184 844.282 844.38 844.477 844.575 844.673 844.771 844.868 844.966 845.064];
x=[0.001035789 0.001436904 0.001364923 0.002225498 0.003208845 0.003747225 0.002493808 0.001551733 0.001103887 0.000977157
];
opt=optimset('display','off');
x0=[7,0.0015,0.3,850];
for ii=1:100
x=lsqcurvefit(f,x0,t,x,[],[],opt);
x0=x;
end
cc=corrcoef(t,f(p,t));
运行结果是:??? Error using ==> lsqncommon at 101
LSQCURVEFIT cannot continue because user supplied objective function failed with the
following error:
Error using ==> mpower
Matrix must be square.
Error in ==> lsqcurvefit at 186
[x,Resnorm,FVAL,EXITFLAG,OUTPUT,LAMBDA,JACOB] = ...
我想拟合洛伦兹线性 展开
1个回答
展开全部
clear all;
f=@(p,t)(p(1)+(2*p(2)/pi)*(p(3)./(4*(t-p(4)).^2+p(3)^2)));
t=[844.184 844.282 844.38 844.477 844.575 844.673 844.771 844.868 844.966 845.064];
x=[0.001035789 0.001436904 0.001364923 0.002225498 0.003208845 0.003747225 0.002493808 0.001551733 0.001103887 0.000977157
];
opt=optimset('display','off');
x0=[7,0.0015,0.3,850];
for ii=1:100
p=lsqcurvefit(f,x0,t,x,[],[],opt);
x0=p;
end
cc=corrcoef(t,f(p,t));
f=@(p,t)(p(1)+(2*p(2)/pi)*(p(3)./(4*(t-p(4)).^2+p(3)^2)));
t=[844.184 844.282 844.38 844.477 844.575 844.673 844.771 844.868 844.966 845.064];
x=[0.001035789 0.001436904 0.001364923 0.002225498 0.003208845 0.003747225 0.002493808 0.001551733 0.001103887 0.000977157
];
opt=optimset('display','off');
x0=[7,0.0015,0.3,850];
for ii=1:100
p=lsqcurvefit(f,x0,t,x,[],[],opt);
x0=p;
end
cc=corrcoef(t,f(p,t));
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询