MATLAB: Compare Raw Data to Actual Circle

circlecompareplottingreal time

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.

Best Answer

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))