This may sound like an old question. I thought I know the code, but running it does not give me expected values.
My problem is:
target function: f = C / (x ^ p * y ^ q)
(if you know something about machining, you can tell that this is the Taylor's tool life equation)
x
and y
are independent variables; f
is dependent variable; C
, p
and q
are coefficients.
I have three sets of ([x, y], f)
values as the following, please see "exp_result".
And I am looking for a best-fit surface for the three sets of values.
Here's my code:
By running it I get:
C 1.224E4
p 2.025
q 5.688
So the equation of my best-fit surface is T = 1.224E4 / (x ^ 2.025 * y ^ 5.688)
.
However, at least I found that this equation fits the three sets of data better:
T = 9.83E7 / (x ^ 3.39 * y ^ 2.63)
.
By plugging in the x
's and y
's, I get far closer f
's using this equation. Anyone has an idea where I did wrong?
Any suggestions are appreciated. Thank you!
exp_result = [153.6 0.51 22.47; 192.01 0.61 6.52; 230.42 0.51 5.58];
f_exp = fittype('C / (x ^ p * y ^ q)', 'coefficients', {'C', 'p', 'q'}, 'independent', {'x', 'y'}, 'dependent', {'f'});
f_exp_coef = fit([exp_result(:,1), exp_result(:, 2)], exp_result(:, 3),f_exp);