Generate coordinates (3D), having the same contour as the initial circle but with a smaller size

2 次查看(过去 30 天)
Hi! Starting from nodes arranged as a circle in space (blue points), I must generate others having the same outline as the blue points, but creating the lines: red, green, violet.
Note: the red, green, violet lines in the drawing are very approximate
nodes = importdata("plane_new_ok.mat");
center = importdata("node_new_ok.mat");
figure
plot3(nodes(:,1),nodes(:,2),nodes(:,3),'b.','Markersize',15)
hold on
plot3(center(:,1),center(:,2),center(:,3),'b.','Markersize',15)
plot3(nodes(:,1),nodes(:,2),nodes(:,3),'b-','LineWidth',1)
hold off
grid off
xlabel('x')
ylabel('y')
zlabel('z')
axis equal

采纳的回答

Star Strider
Star Strider 2024-1-18
编辑:Star Strider 2024-1-18
One approach —
nodes = importdata("plane_new_ok.mat");
center = importdata("node_new_ok.mat");
rf = scatteredInterpolant(nodes(:,1),nodes(:,2),nodes(:,3));
a = atan2(nodes(:,2)-center(2), nodes(:,1)-center(1));
r = hypot(nodes(:,2)-center(2), nodes(:,1)-center(1));
rc = r/4*(1:3);
xc3 = rc .* cos(a) + center(1);
yc3 = rc .* sin(a) + center(2);
zc3 = rf(xc3, yc3);
figure
plot3(nodes(:,1),nodes(:,2),nodes(:,3),'b.','Markersize',15)
hold on
plot3(center(:,1),center(:,2),center(:,3),'b.','Markersize',15)
hp3 = plot3(xc3, yc3, zc3, '.', 'Markersize',15);
hp3(1).Color = 'm';
hp3(2).Color = 'g';
hp3(3).Color = 'r';
hold off
grid off
xlabel('x')
ylabel('y')
zlabel('z')
axis equal
view(-30,30)
EDIT — Changed line to marker in added circles.
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by