Azzera filtri
Azzera filtri

Fit curve to data with constraints

2 visualizzazioni (ultimi 30 giorni)
Justin Solomon
Justin Solomon il 27 Nov 2012
I have some function, f(x) that I want to fit to some measured data. Say for example that f(x)=a*x^2+b*x+c. Is there a way to constrain the fit such that f(x)>=0? In other words, any combination of a,b,c that will result in f(x) being negative (within limits of x that I define) I don't want.
Here I have given a simple example where f(x) is just a second order polynomial of one variable. In this simple case above I could set limits on a,b, and c such that f(x)>0, however, the f(x) that I am actually fitting to the data is much more complex. I am currently using the cftool to do the fit. I also have some experience using the fit(), and lsqnonlin(). Any suggestions or ideas?

Risposte (1)

Matt J
Matt J il 27 Nov 2012
Modificato: Matt J il 27 Nov 2012
This FEX function claims to be able to provide such constraints, though I haven't verified it first hand
It requires the Optimization Toolbox, however, and it forces you to do the fit using spline models.
  1 Commento
Justin Solomon
Justin Solomon il 3 Dic 2012
Thanks for the suggestion. It looks like this function is only able to do fits with one independent variable. I have several (i.e., f(x1,x2,x3,...). Otherwise, I think this might work.

Accedi per commentare.

Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by