function rcalc = kin2F(x,xdata); % assign variable names to make it easier to type rate equation below kf = x(1); kr = x(2); KA = x(3); KB = x(4); cA = xdata(:,1); cB = xdata(:,2); % compute the "calculated" rate, rcalc rcalc = (kf * cA - kr * cB) ./ (1 + KA * cA + KB * cB); % dot . needed before / since numerator and denominator are % matrices and you don't want matrix division, just % division of individual elements in the matrices % dot . NOT needed before the * here since k, KA, KB are scalars