I have data on the form (x, y, z, v), in other words three spatial coordinates and one velocity magnitude. I would like to plot this in 3D, where the velocity magnitude is shown using color.
What is the best way to do this in MATLAB?
I assume you have trajectory data, so that your spatial coordinates represent the trajectory through space of one or more particles. In that case:
Have a look at quiver3 or coneplot.
If you want colored arrows, then have a look at quiver3d or quiverc (2D only) on the File Exchange.
If you only have 3 spatial coordinates and speed (= velocity magnitude), then your best bet is scatter3.
I could go on, but could you give me a bit more detail on what you want exactly?
x, y, z and three velocity components vx, vy, vz. It describes the flow around a car, so my data is taken from the surface of the car -- and I basically want the direction and magnitude of the velocity shown. coneplot actually looks promising for this, what do you say?Have you tried surf(x,y,z,v)?