MATLAB: Curve Fitting for non-continuous data with infinity

curve fittingnonlinear

Hello,
I am currently doing some experiments with a SLS/SLM machine in which I measure the width of the product of the experiment in relation to the speed that the laser is moving. For example:
Speed in mm/sec:
Speed = [0.1:0.1:1.3];
Measured width in mm:
Width = [3.46 2.45 2.22 2.00 1.20 1.10 1.09 1.00 0.75 0.65 0.62 0.55 0.42];
My problem is the following:
The data I presented above can be easily curve fitted into a 5-degree polyonim. However, the reality of the phenomenon I study indicates that at 0 mm/sec speed I will have 0 mm width and when the limit of the speed of the laser approaches 0, then the limit of the width will approach infinity. Also when the limit of the laser speed approaches infinity, then the limit of the width will approach zero.
How is it possible to contruct a curve fitting model to include these characteristics?
Thank you for your time in advance.

Best Answer

(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:
plot(Speed,Width)
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.
Related Question