Solving a large set of loosely related systems of linear equations (Curve fitting)

1 次查看(过去 30 天)
Hi all,
I'm trying to do curve fitting on some data using the following,
y = M( P , x)*H(x) (eq 1)
where M is a matrix function of parameters P and the independent variable x, H(x) is an unknown vector function of x and y is an observed vector for each x.
I have to find P and H(x) such that at all x, * The aforementioned equation holds * H(x) is smooth and strictly positive
I'm having issues enforcing condition number 2 - specifically continuity.
You can see that this problem is a two stage fitting problem. First, I have to chose an estimate for the parameters, solve the system of equations for each x.
Second, I use the total of sum of squared errors (i.e. the sum of the L2-norms of the error vectors) to refine the estimate of P.
This works roughly 'ok' estimating P but does considerably worse at estimating H(x). My guess is that this is so because the system of equations corresponding to each x is solved independently of the others; lsqlin does "too good a job" fitting eq (1) at each x so that frequent jumps can be seen when plotting H(x) vs x.
I know that regularization techniques might help me solve my problem (because I'm willing to accept some bias in exchange for continuity) but I've very little experience using said techniques.
All comments are appreciated.
Regards, German.

回答(1 个)

Vidhi Agarwal
Vidhi Agarwal 2025-5-30
I understand you’re trying to estimate parameters "P" and an unknown smooth, strictly positive vector function "H(x)" such that:
y(x)=M(P,x)H(x)
And you are facing issue due to discontinuities and jumps in the estimated "H(x)" across values of "x" because the problem is solved independently for each x without enforcing smoothness. To enforce smoothness and positivity on "H(x)" while estimating both "P" and "H(x)", you can adopt a regularized global optimization framework. Below given steps can help you in getting started:
  • Rather than solving for "H(x)" independently at each "x", stack all "H(x_i)" into a large vector "H_total", and solve. Where "R(H_total)" is a regularization term enforcing smoothness and positivity on "H(x)", and "λ" is a regularization parameter that controls the bias-variance tradeoff.
  • Use finite differences to penalize variations between successive "H(x_i)" values. Where "D" is a discrete difference matrix ("diff(eye(n))" style in MATLAB).
  • Add positivity constraints in the optimizer such as use "fmincon" or "lsqlin" with lower bounds: "H(x) > 0". If positivity is strict (no zeros allowed), use "log(H(x))" parameterization and optimize in log-space.
For better understanding of "fmincon" or "lsqlin" refer to the following documentation:
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Linear Least Squares 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by