Generate coordinates (3D), having the same contour as the initial circle but with a smaller size
1 view (last 30 days)
Show older comments
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1594046/image.png)
0 Comments
Accepted Answer
Star Strider
on 18 Jan 2024
Edited: Star Strider
on 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.
.
0 Comments
More Answers (0)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!