matlab中使用inline 和 nlinfit 报错!代码: myfunc=inline('a(1)/abs(x)+a(2)/sqrt(abs(x))+a(3)+a(4)*sqrt(abs(x))+a(5)*abs(x)','a','x');a=nlinfit(x,y,myfunc,[0.5 0.1 0.2 0.3 0.4]);错误:? Error using ==> nlinfit at 113Error evaluating inline
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 04:12:55
matlab中使用inline 和 nlinfit 报错!代码: myfunc=inline('a(1)/abs(x)+a(2)/sqrt(abs(x))+a(3)+a(4)*sqrt(abs(x))+a(5)*abs(x)','a','x');a=nlinfit(x,y,myfunc,[0.5 0.1 0.2 0.3 0.4]);错误:? Error using ==> nlinfit at 113Error evaluating inline
matlab中使用inline 和 nlinfit 报错!
代码:
myfunc=inline('a(1)/abs(x)+a(2)/sqrt(abs(x))+a(3)+a(4)*sqrt(abs(x))+a(5)*abs(x)','a','x');
a=nlinfit(x,y,myfunc,[0.5 0.1 0.2 0.3 0.4]);
错误:
? Error using ==> nlinfit at 113
Error evaluating inline model function.
Error in ==> allan at 32
a=nlinfit(x,y,myfunc,[0.5 0.1 0.2 0.3 0.4]);
Caused by:
Error using ==> inlineeval at 15
Error in inline expression ==>
a(1)/abs(x)+a(2)/sqrt(abs(x))+a(3)+a(4)*sqrt(abs(x))+a(5)*abs(x)
Matrix dimensions must agree.
matlab中使用inline 和 nlinfit 报错!代码: myfunc=inline('a(1)/abs(x)+a(2)/sqrt(abs(x))+a(3)+a(4)*sqrt(abs(x))+a(5)*abs(x)','a','x');a=nlinfit(x,y,myfunc,[0.5 0.1 0.2 0.3 0.4]);错误:? Error using ==> nlinfit at 113Error evaluating inline
inline函数中的除应该用./
a(1)./abs(x)+a(2)./sqrt(abs(x))+a(3)+a(4)*sqrt(abs(x))+a(5)*abs(x)