Single best fit curve for multiple datasets

7 views (last 30 days)
Neil
Neil on 3 Dec 2014
Commented: dpb on 4 Dec 2014
I have multiple data sets which are not the same length. I am trying to find the best fit curve for all these data points rather than single data point. If I concatenate it will throw the best fit curve off.
Specifics
I have 23 data sets from 23 different jumping spiders. Each data set contains x and y values of each spider as it jumps, travels through the air, and lands. I am attempting to use a scatter plot to put all of the datasets on one plot and find the best fit curve for ALL of the jumping spiders. The best fit curve is some sort of quadratic I expect.
When I do the "hold on" command it treats each data set as a separate data set, when I get the best fit curve it is for that single data set rather than for all of the cumulative data sets. If I concatenate I lose the curves due to the function I wrote to get the curves. The reason for this is because each spider starts at different x and y value so I had to make a function to normalize. So if I concatenate all data sets the whole data set is normalized and I lose the individual curves.
Please help! Thanks in advance.
Edit
@ dpb, Thank you. It has been interesting looking at the spiders and their jumps. However, time is not needed to be taken into consideration, at least at this point. But if I did need to take it into account, I used a camera shooting at 1000fps which allows me to consider the avg velocity (with an avg dist of 5cm) and so on. What is needed are the x and y. The reason is, I am trying to look at different jumps of the spiders to see if there is a difference between the jumps and if there is a difference, characterize these differences. So I hope to plot x vs y to get a best fit equation for all the data sets.
When analyzing all the jumps I set the origin at the hind legs of all spiders, which have different leg lengths and other variables making the origins different enough to be significant. I could go back and set the origin at the center of mass, but this would take a considerable amount back tracking. Further, each spider jumps a different distances, ranging from 4-10cm, so by normalizing I hoped to reduce the significance of the variability and make the origin the same for all spiders.
Even though I normalized all spiders' jumps the main issue is finding a single best fit curve for multiple data sets without concatenating.
Thanks for your interest!
P.S. If you suggest a script, please explain line by line, my Matlab skills are very rudimentary.
  1 Comment
dpb
dpb on 4 Dec 2014
Not sure why you keep talking about "concatenting". Don't you have a set of x,y data for each specimen? Have you plotted these data to see if it even makes sense to try to fit a single expression to them? You can simply put all the data into a bag and fit it and see what happens; OLS is such that works just fine numerically. Now whether it makes any sense is dependent upon the data characteristics.
Don't think can help realistically here beyond that without seeing the data. You can attach a file here or if don't want it public, in this case I'll allow as how you can contact me directly and I'll look for it...

Sign in to comment.

Answers (1)

dpb
dpb on 3 Dec 2014
Think need a little (or a lot) more info...but basically you've got to redo the processing to keep the individual time series after the normalization to a common origin. I would presume this would be, basically, simply subtracting the origin for each from the values to have an arbitrary 0,0 origin?
Once you've got that with an x,y for each, unless they're grossly different should simply be able to fit all. Plotting should make it obvious whether that's a reasonable assumption or not; no way we can tell that a priori w/o seeing the data (which sounds kinda' interesting, btw)...

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!