Draw arc with specified angle difference

1 visualización (últimos 30 días)
Elysi Cochin
Elysi Cochin el 9 de Jun. de 2021
Comentada: Star Strider el 10 de Jun. de 2021
Having 2 datas as attached in Data.mat, how to draw arc with a specified angle difference (angle difference can vary say 15, 30 or any other value as given by user)
The data columns in order are angle, radius, depth
How can i find the center with the attached data, so that both the arcs pass through the center, and display it in x,y,z coordinate
  3 comentarios
Elysi Cochin
Elysi Cochin el 9 de Jun. de 2021
Editada: Elysi Cochin el 9 de Jun. de 2021
Sir the given values are in degrees, we need to convert it into radians. Compute the center and both the curves must pass through the center. Is it possible sir, with this information I have only so much details
Elysi Cochin
Elysi Cochin el 9 de Jun. de 2021
Sir, can you show me how to plot, if the angles are radian values (descending spiral)

Iniciar sesión para comentar.

Respuesta aceptada

Star Strider
Star Strider el 9 de Jun. de 2021
Try this —
LD = load('Data.mat');
Data1 = LD.Data1;
A1 = Data1(:,1);
R1 = Data1(:,2);
D1 = Data1(:,3);
Data2 = LD.Data2;
A2 = Data2(:,1);
R2 = Data2(:,2);
D2 = Data2(:,3);
ctrfcn = @(b,a,r,d) [sqrt((b(1)+r.*cosd(a)).^2 + (b(2)+r.*sind(a)).^2 + (b(3)-d).^2)];
[B1,fval] = fminsearch(@(b)norm(ctrfcn(b,A1,R1,D1)), -rand(3,1)*1E+4)
[B2,fval] = fminsearch(@(b)norm(ctrfcn(b,A2,R2,D2)), -rand(3,1)*1E+4)
figure
plot3(R1.*cosd(A1), R1.*sind(A1), D1, 'm')
hold on
plot3(R2.*cosd(A2), R2.*sind(A2), D2, 'c')
scatter3(B1(1), B1(2), B1(3), 30, 'm', 'p', 'filled')
scatter3(B2(1), B2(2), B2(3), 30, 'c', 'p', 'filled')
hold off
legend('Data_1','Data_2', 'Centre_1', 'Centre_2', 'Location','best')
grid on
The axes are not scaled to be equal, because it then appears to be a flat surface.
Data1 Center:
x = -740.85
y = -349.01
z = 3.83
Data2 Center:
x = -740.96
y = -348.77
z = 3.81
.
  5 comentarios
Elysi Cochin
Elysi Cochin el 10 de Jun. de 2021
Sir, shall i ask you one thing, why does the plotted center point lie away from the curves?
What i meant by center is the center point of the curve (means if we take a line of 10cm the center point is 5cm). By center i meant that.
Star Strider
Star Strider el 10 de Jun. de 2021
As a general rule when talking about arcs or circles, the center is the center of the circle. It can never be on any of the circumferences.
You are asking for the midpoint of the arc.
MP1 = median([R1.*cosd(A1)+B1(1), R1.*sind(A1)+B1(2), D1],1);
MP2 = median([R2.*cosd(A2)+B2(1), R2.*sind(A2)+B2(2), D2],1);
fprintf(1,'Arc Midpoint 1:\n\t\tx = %8.2f\n\t\ty = %8.2f\n\t\tz = %8.2f\n',MP1)
fprintf(1,'Arc Midpoint 2:\n\t\tx = %8.2f\n\t\ty = %8.2f\n\t\tz = %8.2f\n',MP2)
produces —
Arc Midpoint 1:
x = 745.33
y = 366.43
z = 3.83
Arc Midpoint 2:
x = 752.68
y = 364.83
z = 3.82
That is the best I can do.

Iniciar sesión para comentar.

Más respuestas (2)

Image Analyst
Image Analyst el 9 de Jun. de 2021
  1 comentario
Elysi Cochin
Elysi Cochin el 9 de Jun. de 2021
Sir, i saw that link, but the data I have, is different with the example shown in the link.

Iniciar sesión para comentar.


darova
darova el 9 de Jun. de 2021
Wha about this representation?
s = load('data.mat');
t = linspace(0,1,20)*pi/180; % angle array
[X,Y,Z] = deal( zeros(10,20) ); % preallocation matrices
for i = 1:10
[X(i,:),Y(i,:)] = pol2cart(t*s.Data1(i,1),s.Data1(i,2)); % create arc
Z(i,:) = s.Data1(i,3); % depth
end
surf(X,Y,Z)
  1 comentario
Elysi Cochin
Elysi Cochin el 9 de Jun. de 2021
Editada: Elysi Cochin el 9 de Jun. de 2021
Sir how to convert the radius value from degrees to radians and plot the figure
also, at a time i want to give only one angle

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by