![]() |
非线性回归出现的错误了,大家试过吗?
m文件如下:
function [result1,result2 ]= nlinfitfunc(x,y,c01,t1) global c0 t % NLINFITFUNC Summary of this function goes here % Detailed explanation goes here % x=[1.5 2.5 3.5 5 7 9 11]; % y=[0.524 0.4273 0.2715 0.1522 0.0684 0.0385 0.043]; %初始赋值 c0=c01; t=t1; beta0=[0.3,0.000003]; result=nlinfit(x,y,@model,beta0); %结果1 result1=result(1); %结果2 result2=result(2); format long e; end function y=model(beta0,x) global c0 global t %MODEL Summary of this function goes here % Detailed explanation goes here a=beta0(1); b=beta0(2); %c=sqrt(4*b*t*24*60*60); %d=x/c; %format long e %y=c0+(a-c0)*(1-erf(d)); y=c0+(a-c0)*(1-erf(x/sqrt(4*b*t*24*60*60))); end 用的时候出现这样的错误啊!! [result1,result2 ]= nlinfitfunc(x,y,c01,t1) ??? Error using ==> erfcore Input must be real. Error in ==> erf at 21 y = erfcore(x,0); Error in ==> nlinfitfunc>model at 28 y=c0+(a-c0)*(1-erf(d)); Error in ==> nlinfit>LMfit at 300 yfit = model(beta,X); Error in ==> nlinfit at 167 [beta,J,lsiter,cause] = LMfit(X,y, model,beta,options,verbose,maxiter); Error in ==> nlinfitfunc at 11 result=nlinfit(x,y,@model,beta0); 就是这个erf的问题 |
所有时间均为北京时间。现在的时间是 03:28。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.