It could be that the sample script you copied (from where?) is valid for a different version of the fitnlm function. When you type doc fitnlm (in the Command Window) does the help details include an example similar to what you have tried already?
fitnlm not working on mac
2 次查看(过去 30 天)
显示 更早的评论
%I simply copied this sample script for fitnlm
load carbig
ds = dataset(Horsepower,Weight,MPG);
modelfun = @(b,x)b(1) + b(2)*x(:,1).^b(3) + ...
b(4)*x(:,2).^b(5);
beta0 = [-50 500 -1 500 -1];
mdl = fitnlm(ds,modelfun,beta0)
%and got this error:
Error using nlinfit
Too many input arguments.
Error in NonLinearModel/fitter (line 1118)
[model.Coefs,~,J_r,model.CoefficientCovariance,model.MSE,model.ErrorModelInfo,~]
= ...
Error in classreg.regr.FitObject/doFit
(line 220)
model = fitter(model);
Error in NonLinearModel.fit (line 1421)
model = doFit(model);
Error in fitnlm (line 94)
model = NonLinearModel.fit(X,varargin{:});
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Schedule Model Components 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!