Want to connect 3D scattered data points with line
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello guys,
I am trying to do a 3D scattered data plot and I want to conncet the points from the data with a line, I was able to do it but I am not sattisfied with the result. I dont want to connect the,m one after another, I want to connect point one with point two, then point one with point three and so on, I will insert a picture to make maybe more clear. And also I want to see the distance between two points, how its possible to do this?
Here is the code what I am using:
x = [264 260 293 241 280 259]
y = [264 335 333 318 310 349]; %%I am using the pixel value for Y each point
z = [70 21 27 9 1 53]; %I am using the pixel value for Z each point
figure
axis equal
scatter3(x,y,z, 'filled')
text (x(1),y(1),z(1),'Rot. Point');
text (x(2),y(2),z(2),'Center');
text (x(3),y(3),z(3),'Left');
text (x(4),y(4),z(4),'Right');
text (x(5),y(5),z(5),'Down');
text (x(6),y(6),z(6),'Up');
.
0 comentarios
Respuestas (1)
J. Alex Lee
el 25 de Feb. de 2021
Editada: J. Alex Lee
el 25 de Feb. de 2021
On way is to do it in a loop. After your code,
hold on
d = zeros(size(x)); % to hold distances from the first point
for i = 2:numel(x)
plot3(x([1,i]),y([1,i]),z([1,i]),'-k','LineWidth',2)
d(i) = sqrt((x(1)-x(i))^2+(y(1)-y(i))^2+(z(1)-z(i))^2)
end
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!