Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Difference between NonLinearModel.fit, nlinfit and lscurvefit

Subject: Difference between NonLinearModel.fit, nlinfit and lscurvefit

From: toms Seidel

Date: 18 Sep, 2012 14:49:08

Message: 1 of 7

Hello fellows!

Can anyone point out which function I am supposed to use to fit a nonlinear model function to concrete realizations, i.e. i have f(x) = (a * x + bx^2) / (1-x)^c. I have the corresponding x, f(x) values and want to obtain the best estimates for a, b and c.

Any hints appreciated!

Subject: Difference between NonLinearModel.fit, nlinfit and lscurvefit

From: toms Seidel

Date: 18 Sep, 2012 17:14:08

Message: 2 of 7

Another question, also related to this issue:

Is their any nonlinear regression solver, that allows for dynamic models:

For example I know that the nominator above is a polynom, but I do not know its degree - it might be c(1) + c(2) * x + c(3) * x^2 or c(1) + c(2) * x + c(3) * x^2 + c(4) * x^3

Any ideas?

Subject: Difference between NonLinearModel.fit, nlinfit and lscurvefit

From: toms Seidel

Date: 19 Sep, 2012 11:28:07

Message: 3 of 7

No ideas, guys?
In the meantime I also found out that the initial parameters, i.e. beta0 are of vital importance to the regression models. How can this be?

Subject: Difference between NonLinearModel.fit, nlinfit and lscurvefit

From: John D'Errico

Date: 19 Sep, 2012 11:44:08

Message: 4 of 7

"toms Seidel" wrote in message <k3a1l4$21e$1@newscl01ah.mathworks.com>...
> Hello fellows!
>
> Can anyone point out which function I am supposed to use to fit a nonlinear model function to concrete realizations, i.e. i have f(x) = (a * x + bx^2) / (1-x)^c. I have the corresponding x, f(x) values and want to obtain the best estimates for a, b and c.
>
> Any hints appreciated!

Take your pick. Feel free. Read the help, where lots of hints
are provided, and examples too.

John

Subject: Difference between NonLinearModel.fit, nlinfit and lscurvefit

From: Bruno Luong

Date: 19 Sep, 2012 11:50:08

Message: 5 of 7

"toms Seidel" wrote in message <k3a1l4$21e$1@newscl01ah.mathworks.com>...
> Hello fellows!
>
> Can anyone point out which function I am supposed to use to fit a nonlinear model function to concrete realizations, i.e. i have f(x) = (a * x + bx^2) / (1-x)^c. I have the corresponding x, f(x) values and want to obtain the best estimates for a, b and c.

Any fit functions you mentioned (or lsqnonlin, fminunc, fmincon) would do. They might have different names, the mathematics behind is the same, fitting using numerical optimization on (least-squares) error residuals.

Bruno

Subject: Difference between NonLinearModel.fit, nlinfit and lscurvefit

From: John D'Errico

Date: 19 Sep, 2012 11:53:07

Message: 6 of 7

"toms Seidel" wrote in message <k3aa50$5sv$1@newscl01ah.mathworks.com>...
> Another question, also related to this issue:
>
> Is their any nonlinear regression solver, that allows for dynamic models:
>
> For example I know that the nominator above is a polynom, but I do not know its degree - it might be c(1) + c(2) * x + c(3) * x^2 or c(1) + c(2) * x + c(3) * x^2 + c(4) * x^3
>
> Any ideas?

It looks like you need to start learning about regression
modeling, something that often takes at least a semester,
at least in the old days when I bothered with classes. It
is certainly too broad of a topic to cover here given all
of your questions. I do try to answer SOME questions here:

http://www.mathworks.com/matlabcentral/fileexchange/8553-optimization-tips-and-tricks

though it describes tools in the optimization toolbox.

There is a stepwise fitting tool in the stats toolbox, but
there are many possible models, and it is easy to over-fit
a polynomial to data. Again, it is time to start reading,
a basic text like Draper and Smith is a good place. I think
it is still in print, though many revisions past the copy I
have.

John

Subject: Difference between NonLinearModel.fit, nlinfit and lscurvefit

From: John D'Errico

Date: 19 Sep, 2012 11:58:09

Message: 7 of 7

"toms Seidel" wrote in message <k3ca87$ce8$1@newscl01ah.mathworks.com>...
> No ideas, guys?

Geez, don't be in such a rush. Do you think we lie awake
at night at the keyboard, waiting for your questions?

> In the meantime I also found out that the initial parameters, i.e. beta0 are of vital importance to the regression models. How can this be?

Again, read any text on nonlinear optimization. I talk about
the issue of starting values here too:

http://www.mathworks.com/matlabcentral/fileexchange/8553-optimization-tips-and-tricks

Start reading, or take a course. The questions you have are
too many, too basic, and too broad. It says that you are
looking for vastly more than we can write here.

John

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us