Draw arc with specified angle difference

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 件のコメント

Star Strider
Star Strider 2021 年 6 月 9 日
If the angles are radian values, the data each describe a descending spiral with angles that span nearly 10 radians, or about 1.6 times the circumference of the circle. If they are in degrees, it is almost a straight line, spanning only about 10°.
Please provide details.
Elysi Cochin
Elysi Cochin 2021 年 6 月 9 日
編集済み: Elysi Cochin 2021 年 6 月 9 日
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 2021 年 6 月 9 日
Sir, can you show me how to plot, if the angles are radian values (descending spiral)

サインインしてコメントする。

 採用された回答

Star Strider
Star Strider 2021 年 6 月 9 日

0 投票

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 件のコメント

Elysi Cochin
Elysi Cochin 2021 年 6 月 9 日
編集済み: Elysi Cochin 2021 年 6 月 9 日
Sir why is it line?
When the center values are round, both will become same, with the method you have shown above.
Cant i get an arc or curve structure, with the values given? Can we draw both the curves through any one center or the rounded center value?
If the above is not possible, using the data attached, can i get 2 curve which intersect almost in the center?
If it is not possible with the attached data only, what additional data is needed to plot so
Star Strider
Star Strider 2021 年 6 月 9 日
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) (b(1)+cosd(a)).^2 + (b(2)+sind(a)).^2 - (b(3).*(r+d)).^2;
[B1,fval] = fminsearch(@(b)norm(ctrfcn(b,A1,R1,D1)), rand(3,1)*1E+1)
[B2,fval] = fminsearch(@(b)norm(ctrfcn(b,A2,R2,D2)), rand(3,1)*1E+1)
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), 50, 'm', 'p', 'filled')
scatter3(B2(1), B2(2), B2(3), 50, 'c', 'p', 'filled')
plot3(R1.*cosd(A1)+B1(1), R1.*sind(A1)+B1(2), D1, '--c')
plot3(R2.*cosd(A2)+B2(1), R2.*sind(A2)+B2(2), D2, '--m')
hold off
legend('Data_1','Data_2', 'Centre_1', 'Centre_2', 'Location','best')
grid on
view(-20,30)
% axis('equal')
fprintf(1,'Data1 Center:\n\t\tx = %8.2f\n\t\ty = %8.2f\n\t\tz = %8.2f\n',B1)
fprintf(1,'Data2 Center:\n\t\tx = %8.2f\n\t\ty = %8.2f\n\t\tz = %8.2f\n',B2)
There was a slight error in the previous code, now fixed. This also draws the arcs.
Data1 Center:
x = 3.32
y = 6.34
z = 0.01
Data2 Center:
x = 3.02
y = 9.67
z = 0.01
.
Star Strider
Star Strider 2021 年 6 月 9 日
First, the curves do not intersect. They are a reasonably constant distance from each other. I did not test them to see if they intersected beyond the arcs provided.
Second, the centres are approximately equal, as are the other parameters. That is simply the nature of the data.
Elysi Cochin
Elysi Cochin 2021 年 6 月 10 日
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 2021 年 6 月 10 日
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.

サインインしてコメントする。

その他の回答 (2 件)

Image Analyst
Image Analyst 2021 年 6 月 9 日

0 投票

1 件のコメント

Elysi Cochin
Elysi Cochin 2021 年 6 月 9 日
Sir, i saw that link, but the data I have, is different with the example shown in the link.

サインインしてコメントする。

darova
darova 2021 年 6 月 9 日

0 投票

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 件のコメント

Elysi Cochin
Elysi Cochin 2021 年 6 月 9 日
編集済み: Elysi Cochin 2021 年 6 月 9 日
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

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeOperating on Diagonal Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by