Sep 18, 2004 #1 M melodyseu Junior Member level 3 Joined Jul 22, 2004 Messages 31 Helped 1 Reputation 2 Reaction score 1 Trophy points 1,288 Activity points 233 nlinfit I'm dealing with the curve-fitting using the function--nlinfit in matlab. Here is the syntax : beta = nlinfit(X,y,'model',beta0), and I don't know how to define the term 'model'. Can you give me some advice,thanks.
nlinfit I'm dealing with the curve-fitting using the function--nlinfit in matlab. Here is the syntax : beta = nlinfit(X,y,'model',beta0), and I don't know how to define the term 'model'. Can you give me some advice,thanks.
Sep 18, 2004 #2 Dspnut Full Member level 2 Joined Jul 18, 2002 Messages 141 Helped 10 Reputation 18 Reaction score 5 Trophy points 1,298 Activity points 1,267 nlinfit example Hi there, You need to define your 'model' as a function (possibly in a seperate m-file). For example >>beta = nlinfit(X,y,myfun,beta0) where MYFUN is a MATLAB function such as: function yhat = myfun(beta, X) b1 = beta(1); b2 = beta(2); yhat = 1 ./ (1 + exp(b1 + b2*X)); MYFUN can also be an inline object: fun = inline('1 ./ (1 + exp(b(1) + b(2*x))', 'b', 'x') nlinfit(x, y, fun, b0) HTH
nlinfit example Hi there, You need to define your 'model' as a function (possibly in a seperate m-file). For example >>beta = nlinfit(X,y,myfun,beta0) where MYFUN is a MATLAB function such as: function yhat = myfun(beta, X) b1 = beta(1); b2 = beta(2); yhat = 1 ./ (1 + exp(b1 + b2*X)); MYFUN can also be an inline object: fun = inline('1 ./ (1 + exp(b(1) + b(2*x))', 'b', 'x') nlinfit(x, y, fun, b0) HTH
Sep 18, 2004 #3 M melodyseu Junior Member level 3 Joined Jul 22, 2004 Messages 31 Helped 1 Reputation 2 Reaction score 1 Trophy points 1,288 Activity points 233 matlab nlinfit thanks