Compare Raw Data to Actual Circle

4 views (last 30 days)
Joel
Joel on 9 Aug 2011
I need to compare my raw data from a motion capture system to an actual circle in the environment. I ask participants to trace a circle with an object for around a minute. I have the data from their actual performance, but want to compare it to the physical circle they are to trace in the environment.
The data is exported in x & y-coordinates. As of now, I have been using just the x-coordinates for analyses. The biggest problem I am facing is that particpants vary in the number of times they complete the circle during the time given.
At this stage I just need to compare their performance to the actual circle in the environment, relative to how many times they complete the circle (if that matters) so I can see how they improved.
Any help will be greatly appreciated.
  2 Comments
Fangjun Jiang
Fangjun Jiang on 9 Aug 2011
Not sure what do you mean "compare". What results do you expect? Please provide some example data.
Joel
Joel on 10 Aug 2011
There is too much data to give as an example. Basically, I have a circle on the ground that an object follows. I have the data for where the object is during the trial, but want to compare it to the actual circle on the ground. I am thinking a way of calculating the radians (just looking at the x-coordinates part of the data) but do not really know where to go from there. I also think frequency is an issue.

Sign in to comment.

Accepted Answer

bym
bym on 9 Aug 2011
I hope this will help
clc;clear;close
x=3.5*cos(linspace(0,2*pi))+rand(1,100);
y=3.5*sin(linspace(0,2*pi))+rand(1,100); % some data
x=x'; y=y';
plot(x,y,'.')
b = [x,y,ones(size(x))]\-(x.^2+y.^2); % best fit circle
ang = atan2(y,x);
xc = -b(1)/2;
yc = -b(2)/2;
radius = sqrt((xc^2+yc^2)-b(3));
xhat = radius*cos(ang)+xc;
yhat = radius*sin(ang)+yc;
hold on
plot(xhat,yhat,'g*')
axis equal
rmse = sqrt(sum(hypot(x-xhat,y-yhat))./numel(x))
  3 Comments
bym
bym on 10 Aug 2011
How is <12005 x 1> a set of x & y coordinates? The data is not too large, perhaps you can post 10 or so lines. Also, I am confused about your statement "I also think frequency is an issue"
Joel
Joel on 12 Aug 2011
Sorry:<12005 x 2>***
For some reason there was an extra data point in one of my columns which was messing up the last row for the y column. You are correct, the data is not too large and your original answer is working perfectly! Thank you very much for your time.
-The reason I think frequency is an issue is because I am still trying to compare their actual data to the original circle, not a best fit, as another measure. If I plot just the x values, each trial has a different number of cycles (e.g. trial 1 = 6pi; trial 2 = 8pi), so I am also trying to plot the performance x values relative to where the circle actually is in the physical environment. I cannot figure out how to successfully do that with respect to how many times they completed the circle.
Any ideas on that will be greatly appreciated but again, thank you for your original answer!

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!