multivariable curve fitting with constraints
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I'm confused from all the least squares functions which is supported by Matlab: I have a function which is the basis for curve fitting f(x,y,z), some test input data:
xdata=[x,y,z];
and corresponding output data
ydata=y;
I'd like to perform curve fitting of f(x,y,z) to the test.
Some constraints that I would like to use:
x_a < x < x_b
y_a < y < y_b
z_a < z < z_b
f(x,y,z)>=0 for each x,y,z in the domain
Please assist with function which I should use and the corresponding input parameters for it.
Other option: based on the xdata, ydata and constraints, I'd like to get an analytic function f(x,y,z) which best fits the data and constraints.
0 commentaires
Réponses (1)
Matt J
le 23 Oct 2016
Modifié(e) : Matt J
le 23 Oct 2016
LSQCURVEFIT would be one choice,
x = lsqcurvefit(func,x0,xdata,ydata,lb,ub)
As you can see in the documentation, it readily allows you to specify upper and lower bounds lb and ub on the parameters, x. You have to decide on the parametric model and supply a function handle (func) to it of the form F(x,xdata). You would also have to provide an initial parameter guess x0 for the iterative estimation.
The positivity requirement on the function f(x,y,z)>0 will probably require you to choose a parametric family which is inherently positive, e.g., a Gaussian lobe mixture.
4 commentaires
Matt J
le 26 Oct 2016
Modifié(e) : Matt J
le 26 Oct 2016
The bounds that you gave in your posted example are on f(x), namely f(x)>=0. x is an independent variable controlled by you.
Constraining f(x)>=0 over a continuous region of x is not something MATLAB has tools for for multi-dimensional x. For scalar x, you could use fsemininf().
The simplest way to ensure f(x)>=0 is to choose an f(x) that can never be negative for any choice of the unknowns. As I mentioned, an inherently positive parametric family like a mixture of Gaussians would do this.
If you're saying that you're stuck with a more complicated family, then the best solution will likely be specific to that family. For a linear family f(x)=ax+b, you would take advantage that f reaches its extremes at the vertices of the region lb < x < ub. Constraining a*x+b>=0 is then just a simple matter of imposing the linear constraints,
a*lb + b >=0
a*ub + b >=0
You could do the same thing for linear functions in n-dimensions.
Voir également
Catégories
En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!