|
Oluwa KuIse wrote:
> function [Y]= pinpongbibi(X)
> Y = X(:,3).*X(:,1).*X(:,2)./(X(:,1).*X(:,2)+X(:,4).*X(:,1).*(1+X(:,1)./X(:,6))+X(:,5).*X(:,2));
> The command window gave me this error:
>
> Error in ==> reactionrate at 15
> beta = nlinfit(X,y,@pinpongbibi,BETA0);
>
> Caused by:
> Error using ==> pinpongbibi
> Too many input arguments.
>
> Does anyone know why I am getting this? I have tried to look through the documentation of nlinfit but I don't seem to understand the jargon used.
Here's the relevant part:
>> help nlinfit
NLINFIT Nonlinear least-squares regression.
[snip]
MODELFUN is a
function, specified using @, that accepts two arguments, a coefficient
vector and the array X, and returns a vector of fitted Y values.
Your model function only accepts one argument. It is supposed to do a calculation involving coefficients and predictor variables. Yours seemingly doesn't involve coefficients at all. See also the example in the help:
Examples:
Use @ to specify MODELFUN:
load reaction;
beta = nlinfit(reactants,rate,@mymodel,beta);
where MYMODEL is a MATLAB function such as:
function yhat = mymodel(beta, x)
yhat = (beta(1)*x(:,2) - x(:,3)/beta(5)) ./ ...
(1+beta(2)*x(:,1)+beta(3)*x(:,2)+beta(4)*x(:,3));
|