You are not logged in.
Pages: 1
If I have some data and I do a scatter plot of the data.
How could I produce a function which plots a line through the data points?
Would it have to be piecewise, between the points or could you have one function and some algorithm to do this?
Can feel it coming together.. Slowly but Surely
Offline
Hi Dave;
Just provide me with the data the scatter plot will not be necessary.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Hi Bobby
It's nothing actually recorded, and the set is not big (only 5 elements). I was just trying to see how I could put what I am learning into some practice.
The set is this
Time(t) Fluid(F)
0 0
1 3
2 10
3 12
4 15
5 18
I can do plots and regression lines and also find gradients between the elements, but not sure how I would go about creating something that would smoothly pass through them as a function of (t)
Also my MATLAB has stopped working, so trying to fix that at the moment.
Can feel it coming together.. Slowly but Surely
Offline
Hi dave;
The least square fit through that is
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Would you have to do something like Fourier Analysis to get a smooth curve?
Can feel it coming together.. Slowly but Surely
Offline
You don't need a fourier fit. I can fit a polynomial through all the points. What kind of fit do you require?
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
not sure, I am just trying to put what I have learned to some practical use.
Say I go out everyday and measure the growth of a plant, and wanted to find the rate at which it is growing on a particular day.
I suppose what I am asking it how do you create a polynomial that fits the data.
Can feel it coming together.. Slowly but Surely
Offline
Hi dave;
For an interpolating polynomial, one that goes through all the points exactly:
I have to caution you about going past your data points to make predictions for the future. Interpolation or going between your data points is much more reliable. Extrapolation can only be done when you know the underlying law of the points. Usually a DE. A fit cannot guarantee that it will continue.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Hi Bobby
Thanks for this, I will have a go with that one.
Is there some process that you used to get the result, that works universally or is it dependent on the data?
Can feel it coming together.. Slowly but Surely
Offline
Yes, there is. For the first one as you know from linear regression there is a formula. For the interpolating poly there is a method. You must solve a 5 x 5 linear set of simultaneous equations. This is difficult by hand. Best done by computer. That is why we use least squares over interpolation. We are always dealing with a smaller degree polynomial, less computational hassles.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Cool.
Yes, just been looking at Linear Interpolation on Wikipedia. I can see how that it complicated and would take some time.
Can feel it coming together.. Slowly but Surely
Offline
Hi Dave;
I am having trouble uploading any images right now so I can't show the plots of these functions. Because it is only 6 points we can a do an interpolating fit. But what if it were 10000 points. Nobody wants to look at a 10000 degree polynomial. That is where least square fits come in handy.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Hi Bobby
Yes I see. The least squares fit is more accurate over a large number of points, than it seems to be with a small number.
You always see these diagrams in books with 5 or 6 points and fitting doesn't look that good.
Can feel it coming together.. Slowly but Surely
Offline
Hi;
For a very big number of points it is the only option.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Pages: 1