- ‘Q’ is not defined, and does not appear to be necessary in your argument list in any event;
- Your regression is actually linear, so you could use the regress or fitlm functions to get the parameters and statistics.
Fitting nonlinear regression model
2 views (last 30 days)
Show older comments
I have 5 input variables organized in a table:
dt, sinday, cosday, sinhour, coshour
The dependent variable is Q (number of observations).
I wrote the following script:
tbl = table(dt,sinhour,coshour,sinday,cosday);
beta0 = [0;0;0;0;0;0];
modelfun = @(b,x) b(1) + b(2)*dt + b(3)*sinhour + b(4)*coshour + b(5)*sinday + b(6)*cosday;
md1 = fitnlm(tbl,Q,modelfun,beta0);
But it is giving the following error message while running:
Error using internal.stats.parseArgs (line 42)
Wrong number of arguments.
Error in NonLinearModel.fit (line 1379)
[coefNames,predictorVars,responseVar,weights, ...
Error in fitnlm (line 94)
model = NonLinearModel.fit(X,varargin{:});
Error in nlmfitoccu (line 57)
md1 = fitnlm(tbl,Q,modelfun,beta0);
I am not been able to sort it out.
0 Comments
Answers (1)
Star Strider
on 19 Aug 2015
Two observations:
0 Comments
See Also
Categories
Find more on Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!