I HAVE PLOTTED AN ELLISE FROM A SET OF DATA FROM A CSV TABLE.
MY CHALLENGE IS I WANT TO CALCULATE ANGLE OF ROTATION, MAJOR AND MINOR AXIS AND ECCENTRICITY. hOW DO I DI THAT. i HAVE ATTACHED MY CODE
clear all;
clc;
fid = fopen ('No_Fault.csv');
readData = textscan(fid, '%f %f %f', 'HeaderLines', 1, 'Delimiter',',');
xData = readData{1, 1}(:,1);
x1Data = readData{1, 2}(:,1);
x2Data = readData{1, 3}(:,1);
f1 = figure(1);
cla; hold on; grid on;
% plot (xData, x1Data,'k-');
% plot (xData, x2Data,'r-');
plot (x1Data, x2Data,'r-');

4 comentarios

Image Analyst
Image Analyst el 13 de Jul. de 2020
Don't you want to supply us with 'No_Fault.csv' so we can run your code???
Tafadzwa Masocha
Tafadzwa Masocha el 13 de Jul. de 2020
im failing to attach. let me keep trying
Tafadzwa Masocha
Tafadzwa Masocha el 14 de Jul. de 2020
thanks

Iniciar sesión para comentar.

 Respuesta aceptada

Image Analyst
Image Analyst el 14 de Jul. de 2020
Try this:
fid = fopen ('No_Fault.csv');
readData = textscan(fid, '%f %f %f', 'HeaderLines', 1, 'Delimiter',',');
xData = readData{1, 1}(:,1);
x1Data = readData{1, 2}(:,1);
x2Data = readData{1, 3}(:,1);
f1 = figure(1);
cla; hold on; grid on;
% plot (xData, x1Data,'k-');
% plot (xData, x2Data,'r-');
plot (x1Data, x2Data,'r-');
binaryImage = poly2mask(x1Data, x2Data, 10000, 10000);
props = regionprops(binaryImage, 'Orientation', 'MajorAxisLength', 'MinorAxisLength');
Orientation = props.Orientation % Degrees
MajorAxisLength = props.MajorAxisLength
MinorAxisLength = props.MinorAxisLength
You get:
Orientation =
-59.9061922702959
MajorAxisLength =
54.5758448527965
MinorAxisLength =
7.14123514397741

Más respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.

Preguntada:

el 13 de Jul. de 2020

Comentada:

el 14 de Jul. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by