Improving the interpolation of nodes arranged in a circle on a plane
Show older comments
I am using this code to improve the interpolation of nodes arranged in a circle on a plane.
As input I have the nodes 'outermost_nodes_sel'.
outermost_nodes_sel = importdata("outermost_nodes_sel.txt");
figure
plot3(outermost_nodes_sel(:,1), outermost_nodes_sel(:,2), outermost_nodes_sel(:,3), 'r.', 'Markersize', 15);
hold off
axis equal
xlabel('x')
ylabel('y')
zlabel('z')
% Interpolation
Nt = size(outermost_nodes_sel,1);
t = 1:Nt;
t_new = linspace(1,Nt,3*Nt-1);
line_new = interp1(t,outermost_nodes_sel,t_new);
figure
plot3(line_new(:,1), line_new(:,2), line_new(:,3), 'r.', 'Markersize', 15);
hold off
axis equal
xlabel('x')
ylabel('y')
zlabel('z')
It generates this space for me. How do I insert nodes there too?

Also, is it possible to keep the coordinates of the nodes 'outermost_nodes_sel' fixed?

Accepted Answer
More Answers (1)
hello Alberto
try this - I think it's easier once you work in polar coordinates.
I am not sure to understand by "is it possible to keep the coordinates of the nodes 'outermost_nodes_sel' fixed?" ?
you can overlay both sets of data - this will do nothing to the values of outermost_nodes_sel array
% outermost_nodes_sel = importdata("outermost_nodes_sel.txt");
load("outermost_nodes_sel.mat");
figure
plot3(outermost_nodes_sel(:,1), outermost_nodes_sel(:,2), outermost_nodes_sel(:,3), 'r.', 'Markersize', 15);
hold off
axis equal
xlabel('x')
ylabel('y')
zlabel('z')
[TH,R,Z] = cart2pol(outermost_nodes_sel(:,1), outermost_nodes_sel(:,2), outermost_nodes_sel(:,3));
% Interpolation
Nt = size(outermost_nodes_sel,1);
t = 1:Nt;
TH_new = linspace(min(TH),min(TH)+2*pi,3*Nt-1); % make sure the range is 2*pi
line_new = interp1(TH,[R Z],TH_new);
[x,y,z] = pol2cart(TH_new, line_new(:,1), line_new(:,2));
figure
plot3(x, y, z, 'r.', 'Markersize', 15);
hold off
axis equal
xlabel('x')
ylabel('y')
zlabel('z')
2 Comments
Alberto Acri
on 17 Jan 2024
Mathieu NOE
on 18 Jan 2024
hello again
node_interp = [x(:) y(:) z(:)];
plot3(node_interp(:,1), node_interp(:,2), node_interp(:,3), 'r.', 'Markersize', 15);
Categories
Find more on Interpolation 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!

