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

4 views (last 30 days)
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

Accepted Answer

Star Strider
Star Strider on 13 Aug 2015
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 Comments
Konstantin Kudinov
Konstantin Kudinov on 14 Aug 2015
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 on 14 Aug 2015
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)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!