필터 지우기
필터 지우기

How to estimate weights of the weighted mean?

조회 수: 3 (최근 30일)
Anudeep
Anudeep 2020년 11월 25일
편집: Jason Nicholson 2020년 12월 29일
I have an equation of y = (a1x1 + a2x2 + ... + a81x81)/81
I have a set of y and x values to estimate the coefficients a1, a2, ... , a81.
How do I code to derive the coefficients?
  댓글 수: 1
KSSV
KSSV 2020년 11월 25일
편집: KSSV 2020년 11월 25일
Read about regression, '\', linear least squares.

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

답변 (1개)

Jason Nicholson
Jason Nicholson 2020년 12월 29일
편집: Jason Nicholson 2020년 12월 29일
Put all the each x and y pair on a row. Formulate the matrix A containing all the x1...x81 and x values. Put the y values in a column matrix. Use backslash to linear least squares solve.
pseudo code:
assume each column of x is x1, x2, etc and each row is a point.
A = [x(:,1) x(:,2) ... x(:,81)] in other words, A = x
a = A\y
Note, there is a lot of issues related to stability of this problem. Research linear least squares problem. This is a good place to start: Systems of Linear Equations
Please, remember to accept my answer if it answers your question.

Community Treasure Hunt

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

Start Hunting!

Translated by