Solve for coefficients of a function

1 Ansicht (letzte 30 Tage)
Audrey Cheong
Audrey Cheong am 25 Apr. 2018
Kommentiert: Star Strider am 25 Apr. 2018
Can someone please help me solve for the coefficients (alpha) that minimize the following function?
error = 0 == sum((A-alpha*B).^2);
A = size 1 x 1300 [ 2 45 7 8 3 2 56 ...]
alpha = coefficients of size 1 x n
B = size n x 1300
I am not sure how to write the code and what functions to use. Any help is appreciated!

Akzeptierte Antwort

Star Strider
Star Strider am 25 Apr. 2018
I am guessing that your system is linear.
If so, you can calculate the (1xn) vector of ‘alpha’ coefficients as:
alpha = A/B;
See the documentation on mrdivide,/ (link) for a full discussion.
  2 Kommentare
Audrey Cheong
Audrey Cheong am 25 Apr. 2018
Thank you! Didn't realize it was that easy.
Star Strider
Star Strider am 25 Apr. 2018
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by