multivariable curve fitting with constraints

조회 수: 3 (최근 30일)
michael
michael 2016년 10월 23일
편집: Matt J 2016년 10월 26일
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.

답변 (1개)

Matt J
Matt J 2016년 10월 23일
편집: Matt J 2016년 10월 23일
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
michael
michael 2016년 10월 24일
x0 is the initial assumption on unknown values of the function. In case of f(x)=ax+b, the unknowns are a,b and the bounds are on the value of x, not on the xdata!
Matt J
Matt J 2016년 10월 26일
편집: Matt J 2016년 10월 26일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by