(Really, this is not even a question about MATLAB at all, but a general modeling question. And really, no more than common sense here.)
This is patently silly. You want some computer program to know in some magical way that your function has given behavior at zero and inf, and then provide an intelligent choice of model from infinitely many possible models, then fit it to your data.
Yet you say that for YOU to choose some model that has the desired shape would be too arbitrary?????
Sorry, but you need to provide some model, that has the desired intelligently chosen shape. A general polynomial is just silly here too, since it will never have the desired shape.
Note: even if you used a more general polynomial form, it won't have the desired behavior.
For example, this curve:
1.3182*Speed.^-0.43051 + -0.61613*Speed
fits your data quite well, and has a singularity at 0 as desired, you it fails to have the desired behavior at infinity. If you remove the linear term, the curve fit is poor.
Or, you could use this nonlinear form:
Width = 2.3596*(Speed + 0.74909).^-2.2344
which has the desired behavior at inf, but a singularity around x=-0.75.
Again, you need to provide some intelligent thought about the model.
For example:
So, how could I transform the problem in a way that has a singularity at zero, yet also have the desired behavior at infinity? What simple transformation gives you what you what you are looking for?
semilogx(Speed,Width,'o-')
grid on
Gosh. A straight line fit in that domain would be as much as your data is worth. As well, it looks like an asymptote of zero at infinity seems wrong from these plots.
P1 = polyfit(log(Speed),Width,1)
P1 =
-1.1789 0.67756
So your model is effectively:
width = P1(1)*log(Speed) + P1(2)
Try it out.
plot(Speed,Width,'bo',Speed,P1(1)*log(Speed) + P1(2),'r-')
grid on
Ok, this does not have the desired behavior as Speed --> inf. But your data does not seem to support the idea that Width goes to zero at infinity. You can choose a different model of course. But you need to supply a model that makes sense, AND has the desired characteristics, AND can fit the data.
Computers should never be used to do your thinking for you. You will get garbage if you let that happen. Just apply common sense and basic mathematics.