1
$\begingroup$

I have imported data to a list as below.

nn = Import["df.dat", "Table"];

nn is a 100 by 4 matrix which shows a 3D director field in 100 different points in x-y plane (the vectors are 3d, but their origins are in a 2D plane). To be more clear, $nn[[3, i]]$ shows the component of the vector originated at point 3 in the space. $i=1,2,3$ show the x,y,z component of the vector and i=4 shows the length of the vector.

Also, these 100 points in the 2D plane are arranged on a 10 by 10 square with equal distance.

I really appreciate it if someone can help me to visualize this vector field in an appropriate way.

Below is the first 5 lines of the df.dat file.

0.121963 -0.224769 0.966749 0.340097
0.095170 -0.243081 0.965326 0.340081
0.068667 -0.261505 0.962756 0.340071
0.042826 -0.279722 0.959125 0.340065
0.017990 -0.297426 0.954575 0.340059

The first line corresponds to the point (x,y)=(0,0), the second point to the point (x,y)=(1,0) and so on. The 12th point corresponds to (x,y)=(2,1), the 14th point to (x,y)=(3,1) and so on.

$\endgroup$
8
  • $\begingroup$ Please give a minimal example of your df.dat. $\endgroup$
    – cvgmt
    Dec 20, 2020 at 11:48
  • $\begingroup$ did you see this? mathematica.stackexchange.com/a/26523/1089 $\endgroup$
    – chris
    Dec 20, 2020 at 11:49
  • $\begingroup$ @cvgmt I don't know how to upload it here. $\endgroup$
    – user258046
    Dec 20, 2020 at 12:07
  • $\begingroup$ Just post some part of your data as code. $\endgroup$
    – cvgmt
    Dec 20, 2020 at 12:12
  • $\begingroup$ added now. @cvgmt $\endgroup$
    – user258046
    Dec 20, 2020 at 12:15

1 Answer 1

1
$\begingroup$

An example, that assumes that the vectors on the grid are numbered from 1 to 100:

vecs = Table[{1, 1, 1} i/10, {i, 100}];
origins = Flatten[Table[{i, j, 0}, {i, 10}, {j, 10}], 1];
Graphics3D[Table[Arrow[{t = origins[[i]], t + vecs[[i]]}], {i, 100}]]

enter image description here

$\endgroup$
7
  • $\begingroup$ Could you please use the matrix nn with its 4 columns in your answer so that it becomes clear how your answer is related to the question? $\endgroup$
    – user258046
    Dec 20, 2020 at 12:10
  • $\begingroup$ If I understood your description right, then the 3 first columns give the vector and the fourth its length. In this case the fourth is superfluous because the length is already specified implicitly by the 3 first columns. $\endgroup$ Dec 20, 2020 at 12:13
  • $\begingroup$ It is true. Could you please use the matrix nn in your answer? It is not clear how your solution matches with nn with its first 3 colomns and 100 rows. $\endgroup$
    – user258046
    Dec 20, 2020 at 12:26
  • $\begingroup$ The vectors are numbered: 1..10 for origins {x,y}={1,1}..{1,10}, 11..20 for origins {2,1}.{2,10} e.t.c $\endgroup$ Dec 20, 2020 at 12:29
  • $\begingroup$ I am confused by your solution. I don't see how it is related to the question as I do not see any nn matrix in your solution. $\endgroup$
    – user258046
    Dec 20, 2020 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.