fitnlm not working on mac

1 view (last 30 days)
Stephan Koehler
Stephan Koehler on 24 Jun 2014
%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{:});
  1 Comment
Geoff Hayes
Geoff Hayes on 24 Jun 2014
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?

Sign in to comment.

Answers (0)

Categories

Find more on Schedule Model Components in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!