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.