Vector plot with a discretized data set (x, y, z, vx, vy, vz)

I wanted to make a vector plot with a discretized data set that has 6 columns (x, y, z, vx, vy, vz). The first three columns specifies the starting point of the vector, (vx, vy, vz) specifies the x, y and z components of the vector. I think I should probably use "quiver3" to make the plot as the example ( https://www.mathworks.com/help/matlab/ref/quiver3.html ) here is what I need. However, I cannot find how the data set "wind" is formatted. My data looks like the following, can anyone help me with this? Thanks in advance.
My data set:
%x y z vx vy vz
Data = [
0.250 0.250 0.125 0.000 4.000 0.000
0.250 0.750 0.125 4.000 0.000 0.000
0.750 0.250 0.125 -4.000 0.000 0.000
0.750 0.750 0.125 0.000 -4.000 0.000
0.250 0.250 0.375 0.000 0.000 0.000
0.250 0.750 0.375 0.000 0.000 0.000
0.750 0.250 0.375 0.000 0.000 0.000
0.750 0.750 0.375 0.000 0.000 0.000
0.250 0.250 0.625 0.000 4.000 0.000
0.250 0.750 0.625 4.000 0.000 0.000
0.750 0.250 0.625 -4.000 0.000 0.000
0.750 0.750 0.625 0.000 -4.000 0.000
0.000 0.000 0.250 4.000 -4.000 0.000
0.500 0.500 0.250 -4.000 4.000 0.000
0.000 0.500 0.500 4.000 -4.000 0.000
0.500 0.000 0.500 -4.000 4.000 0.000
0.000 0.500 0.250 0.010 -0.010 0.000
0.500 0.000 0.250 -0.010 0.010 0.000
0.000 0.000 0.500 0.010 -0.010 0.000
0.500 0.500 0.500 -0.010 0.010 0.000 ];

 Accepted Answer

%x y z vx vy vz
Data = [
0.250 0.250 0.125 0.000 4.000 0.000
0.250 0.750 0.125 4.000 0.000 0.000
0.750 0.250 0.125 -4.000 0.000 0.000
0.750 0.750 0.125 0.000 -4.000 0.000
0.250 0.250 0.375 0.000 0.000 0.000
0.250 0.750 0.375 0.000 0.000 0.000
0.750 0.250 0.375 0.000 0.000 0.000
0.750 0.750 0.375 0.000 0.000 0.000
0.250 0.250 0.625 0.000 4.000 0.000
0.250 0.750 0.625 4.000 0.000 0.000
0.750 0.250 0.625 -4.000 0.000 0.000
0.750 0.750 0.625 0.000 -4.000 0.000
0.000 0.000 0.250 4.000 -4.000 0.000
0.500 0.500 0.250 -4.000 4.000 0.000
0.000 0.500 0.500 4.000 -4.000 0.000
0.500 0.000 0.500 -4.000 4.000 0.000
0.000 0.500 0.250 0.010 -0.010 0.000
0.500 0.000 0.250 -0.010 0.010 0.000
0.000 0.000 0.500 0.010 -0.010 0.000
0.500 0.500 0.500 -0.010 0.010 0.000 ];
quiver3(Data(:,1), Data(:,2), Data(:,3), Data(:,4), Data(:,5), Data(:,6));
view(3)

More Answers (0)

Categories

Products

Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!