필터 지우기
필터 지우기

Fitting nonlinear regression model

조회 수: 1 (최근 30일)
Md. Golam Mostafa
Md. Golam Mostafa 2015년 8월 19일
답변: Star Strider 2015년 8월 19일
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.

답변 (1개)

Star Strider
Star Strider 2015년 8월 19일
Two observations:
  1. ‘Q’ is not defined, and does not appear to be necessary in your argument list in any event;
  2. Your regression is actually linear, so you could use the regress or fitlm functions to get the parameters and statistics.

카테고리

Help CenterFile Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by