필터 지우기
필터 지우기

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

조회 수: 1 (최근 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