Non linear Least square fitting

I have a data set with three columns of X, Y and Y_error coordinates... I have to fit a equation
y = a[x^(-1/k) - 37^(-1/k)]
and find a and k along with the error associated with them. Also while fitting we have to consider the 3rd column also i.e the errors with Y coordinate.
So basically I have to do weighted non linear LS fitting and all this without using CFTOOL

답변 (1개)

Star Strider
Star Strider 2014년 11월 1일

0 개 추천

This is how I would do it:
% % b(1) = a, b(2) = k
y = @(b,x) b(1).*[x.^(-1./b(2)) - 37.^(-1./b(2))];
XYE = rand(10,3); % X, Y, Error Vectors Matrix — Create Data
X = XYE(:,1); % X Data
Y = XYE(:,2); % Y Data
W = XYE(:,3); % Weight Data
WLSCF = @(b) sum(W.*(Y - y(b,X)).^2); % Weighted Least Squares Cost Function
B = fminsearch(WLSCF, rand(2,1));
The error vector is apparently the weighting vector. My ‘XYE’ matrix has as its first column X, second column Y and third column E.
See 4.4.3.2. Weighted Least Squares for more information.

카테고리

도움말 센터File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

질문:

2014년 11월 1일

답변:

2014년 11월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by