Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Star Strider
Star Strider le 13 Août 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 commentaires
Konstantin Kudinov
Konstantin Kudinov le 14 Août 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 le 14 Août 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)

Connectez-vous pour commenter.

Plus de réponses (0)

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!

Translated by