Issue: Fitting a set of datapoints to Ellipse and Plotting it to visualise the result

1 view (last 30 days)
Hi,
My coordinates data and the image (currently, which I am getting as output are attached above)forums.PNG
I'm trying to fit some datapoints using the code from the link https://en.mathworks.com/matlabcentral/fileexchange/22423-ellipse-fit
After fitting the data, I am trying to plot the correct ellipse, in contrast to my point data.
Somehow I'm getting the ellipse orientation different. (As attached in the image)
I would be glad if you can have a look at my code below (I am attaching text file below).
data = load (textfile);
scatter (data (:, 1), data (:, 2), 'r' );
hold on ;
[semimajor_axis, semiminor_axis, x0, y0, phi] = ellipse_fit (data (:, 1), data (:, 2));
% [a, b, c, d, f, g] = ellipse_fit (data (:, 1), data (:, 2));
Z = [x0 y0];
A = semimajor_axis;
B = semiminor_axis;
ALPHA = phi;
plot ellipse (Z, A, B, ALPHA);

Answers (0)

Categories

Find more on Visual Exploration 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!