Linear Least Square fit

조회 수: 5 (최근 30일)
dariyoush shiri
dariyoush shiri 2020년 9월 25일
편집: dariyoush shiri 2020년 9월 25일
Hi,
I am new here and I apologize for any mistakes.
I have a problem and I don't know how to solve it please guide me.it"s not a homework or anything.
a data is given and
and y values have variance-covariance
find the optimal parameters c1 and c2 for fitting function
calculate the variance-covariance matrix.
  댓글 수: 2
John D'Errico
John D'Errico 2020년 9월 25일
편집: John D'Errico 2020년 9월 25일
This is a bit confusing.
Are you asking to compute a least squares fit, GIVEN a known covariance matrix on the vector y? If so, then you can use lscov.
Or are you asking to compute a least squares fit, and then estimate a covariance matrix for the parameters?
First, you showed a covariance matrix, but then you ask to compute a covariance matrix.
dariyoush shiri
dariyoush shiri 2020년 9월 25일
sorry for the confusion, I guess to compute a least squares fit, and then estimate a covariance matrix for the parameters. I got this question like I posted. and this is my first atempt on fitting of data so I am confused as well.

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

답변 (1개)

Alan Stevens
Alan Stevens 2020년 9월 25일
For the linear least squares best fit, try:
>> M = [ones(3,1), x.^3];
>> C = M\y
C =
0.6667
0.5000
For the var-covar look up the MATLAB documentation on cov.
  댓글 수: 1
dariyoush shiri
dariyoush shiri 2020년 9월 25일
thank you for the answer, can you please tell me how can I calculate var-cov matrix it manually?

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

카테고리

Help CenterFile Exchange에서 Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by