Solve for coefficients of a function

조회 수: 1 (최근 30일)
Audrey Cheong
Audrey Cheong 2018년 4월 25일
댓글: Star Strider 2018년 4월 25일
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!

채택된 답변

Star Strider
Star Strider 2018년 4월 25일
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
Audrey Cheong
Audrey Cheong 2018년 4월 25일
Thank you! Didn't realize it was that easy.
Star Strider
Star Strider 2018년 4월 25일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by