fit discrete data points with linear combination of discrete user-defined functions

2 次查看(过去 30 天)
Hello,
Can anyone please suggest how to fit a discrete data points D(X) defined on X = start:1:end by a linear combination of N = size(X,1) discrete user-defined instrument response functions (IRFs). IRFs are defined on the same field X.
For example
X = [-2 -1 0 1 2];
D = [3.1 3 2.6 2.4 2.5];
%IRFs(technically should be orthogonal or "almost" orthogonal):
A1 = [3 2 1 0 1 ];
A2 = [1 3 2 1 0 ];
A3 = [1 2 3 2 1 ];
A4 = [0 1 2 3 2 ];
A5 = [1 0 1 2 3 ];
I am looking for scalar coefficients a1...a5, that will minimize D - sum(a1*A1, a2*A2, a3*A3,...).
EDITED: How to request coefficients a_i to be only positive and\or within some boundaries?
Thanks a lot
Konstantin

采纳的回答

Star Strider
Star Strider 2015-8-13
I don’t understand how ‘X’ enters into the calculation, if it does. Otherwise, it seems a straightforward least-squares parameter estimation:
a = [A1' A2' A3' A4' A5']\D';
  2 个评论
Konstantin Kudinov
Konstantin Kudinov 2015-8-14
Star, many thanks for the answer. Do you have an idea, how to request coefficients a_i to be only positive and\or within some boundaries?
Star Strider
Star Strider 2015-8-14
For a constrained linear least-squares problem, see the lsqlin function.
If you only want to specify C, d, lb, and ub, use square brackets [] to specify empty arguments. All arguments have to be in order, so fill the ones you don’t need with square brackets:
x = lsqlin(C,d,[],[],[],[],lb,ub)

请先登录,再进行评论。

更多回答(0 个)

类别

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