Non linear Least square fitting

1 Ansicht (letzte 30 Tage)
aditi
aditi am 1 Nov. 2014
Beantwortet: Star Strider am 1 Nov. 2014
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

Antworten (1)

Star Strider
Star Strider am 1 Nov. 2014
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.

Kategorien

Mehr zu Interpolation 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