Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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

Réponse acceptée

Star Strider
Star Strider le 18 Jan 2024
Modifié(e) : Star Strider le 18 Jan 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.
.

Plus de réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by