From: Shalini on
I am having problem in using nlinfit MATLAB function.
When I use X with 1 column it works but if I use X with 2 columns It
shows an error saying

"MODELFUN should return a vector of fitted values the same length as
Y.
Error in ==> rate at 34
betahat=nlinfit(X,y,'rate_run',beta0)"

Please help me out,
thanks
From: Tom Lane on
> When I use X with 1 column it works but if I use X with 2 columns It
> shows an error saying
>
> "MODELFUN should return a vector of fitted values the same length as
> Y.
> Error in ==> rate at 34
> betahat=nlinfit(X,y,'rate_run',beta0)"

I don't know what your rate_run function looks like. Is it written so that
it can be called with either 1 or 2 columns of X? What do you get when you
type

rate_run(beta0,X)

You should get something with the same size as y. If not, that's your
problem.

You may want to take a look at the "hougen" function that we supply. It's
suitable for use with nlinfit:

>> load reaction
>> b = nlinfit(reactants,rate,@hougen,beta)
b =
1.25259517075571
0.06277627768947
0.04004807885211
0.11241559365397
1.19136842642982
>> size(hougen(b,reactants))
ans =
13 1

-- Tom