Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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

Respuesta aceptada

Star Strider
Star Strider el 18 de En. de 2024
Editada: Star Strider el 18 de En. de 2024
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.
.

Más respuestas (0)

Categorías

Más información sobre Contour Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by