Plotting XYZ Coordinates in 3D with Matlab

2 replies · 20K views · last reply
nritzakis
Messages
1
Reaction score
0
Hi all

This is my first time here, so I will do my best to explain what I need help with.

I have 2 sets of 11 xyz coordinates of some beads that I would like to plot in 3D. I want to show them in 3 space as a before and after (to represent a displacement of each point). I was able to plot the points in OriginLab, but for some points, I cannot tell which two points represent the same beads.

I would like to use Matlab to plot each set of points (on the same 3D plot) connected by an arrowhead which points from the set 1 point to the set 2 point. I have a feeling that would complicated, so perhaps just have each set of points connected, and all the set 1 points be one color, and all the set 2 points be another color.

I hope I didn't confuse you. I included the OriginLab plot as a reference.
 
Attachments
  • 3D scatter plot with X, Y and Z axes showing 22 spheres, 11 red and 11 blue, scattered in the volume; the blue and red points are not paired.
    Graph01.jpg
    21.4 KB · Views: 689
nritzakis, check out Matlab's help on the 'plot3' command.

Code:
help plot3

Also you will want to use a for loop. To plot multiple plots on the same plot on MATLAB you use
Code:
hold on

then to turn it off

Code:
hold off
 
I would use the 'plot3' command to plot the points and then use 'quiver3' to plot the arrows between the points. For making your data points look (somewhat) as spheres, look into the documentation for "linespec" (line specification) and adjust it appropriately when you call the 'plot3' command.