Drawing Vector Diagrams from Point Data

In summary, Mr. Bill Simpson provides code for creating a vector diagram from points, Angry Citizen asks for help with making a vector diagram, and everyone provides help.
  • #1
niloy112
11
0
Do anyone have any software by which i can make a vector diagram from a group of points.you can think it like..suppose you have x & y component of a vector at a point..you can draw that easily but i will have to draw a vector diagram for 100 or more points arranged on a surface...i will give the co-ordinate(x,y) of that points and x&y component values of vectors which works at the respective points..as an example...
x y Vx VY
0 0 2 3
1 0 5 1
2 0 3 3
......
It is urgent
 
Physics news on Phys.org
  • #2
You've really never heard of Excel?
 
  • #3
Thank you "Angry Citizen" for your prompt reply.It will be very helpful for me if you show me the way for 2 or 3 points in excel...Thanks
 
  • #4
Post your 100 or so starting and ending points and what kind of output file format you need.
 
  • #5
Thank you Mr. Bill Simpson for your reply. I am attaching files for your consideration. i am wanting this type of figure.
Thank you for your reply.
 

Attachments

  • Vector diagram.xls
    19 KB · Views: 194
  • VISUALIZATION_OF_FLOW_FIG3.gif
    VISUALIZATION_OF_FLOW_FIG3.gif
    16.7 KB · Views: 525
  • #6
I don't think the exel file has enough information to plot what you want...you talked about x,y,Vx,Vy...and all I see is x,y,z
 
  • #7
I am guessing about a few things, but here is a quick and dirty Mathematica implementation.

In[1]:= v=Import["Vector Diagram.xls"];

In[2]:= vv=Map[Drop[#,1]&,Drop[v,5]]; (*discard "labels"*)

In[3]:= g=Show[Graphics[Reap[
For[y=5/2,y≥0,y-=1/10,
For[x=0,x≤5,x+=1/2,
mx=2x+1;my=10(5/2-y)+1; (*create suitable subscripts*)
Sow[Line[{{x,y},{x+1/15Cos[vv[[my,mx]]Degree],y+1/15Sin[vv[[my,mx]]Degree]}}]];
Sow[Point[{x+1/15Cos[vv[[my,mx]]Degree],y+1/15Sin[vv[[my,mx]]Degree]}]]
]
]
][[2,1]]]]

In[4]:= Export["vectors.gif",g,ImageResolution->300]

Out[4]= vectors.gif

Check this carefully before you depend on it
 

Attachments

  • vectors.gif
    vectors.gif
    14.7 KB · Views: 526
  • #8
Thanks gsl for your reply. I am giving you the x and y component of the vec
 

Attachments

  • x and y component.xls
    25.5 KB · Views: 200
  • #9
Thank you Mr. Bill Simpson for your reply. Please give a favor about one thing. i will use your coding in which software?
Thank you.
 
  • #10
Mathcad is another application that will do what you want.
 

Attachments

  • phys - 12 08 18 vector plot 01.jpg
    phys - 12 08 18 vector plot 01.jpg
    40.1 KB · Views: 443
  • #11
According to your latest excel file where you include separate component for x,y velocity...this is what I get, using python and the pylab module

Code:
from pylab import *
X,Y = meshgrid(arange(0,5.5,0.5), arange(0,2.6,0.1))
U = genfromtxt("vectors-U.txt", dtype=float, delimiter='\t')
V = genfromtxt("vectors-V.txt", dtype=float, delimiter='\t')

figure()
Q = quiver(X,Y,U,V,pivot='mid',color='red',scale=300)
plot(X,Y,'k.')
axis([-1.0,6.0,-0.5,3.0])
title('Velocity')
show()
 

Attachments

  • vectors.png
    vectors.png
    25 KB · Views: 491
  • #12
Thank you everyone for their cordial help.
One thing more "gsal" your given picture is my required one.
But the problem is i have never used python before.If i use your code on this software after installing will it be ok?
Thanks
 
  • #13
niloy112 said: "the problem is that I have never used python before"

...I think we all figured that was going to be the problem...not matter whether the solution was given to you in Mathematica, Mathcad, Matlab, Octave, FreeMat, SciLab, etc...do you know any of these?

...so, one way or another, you are going to have to learn something...

As far as your question about using the code after installing the software "will it be o.k.?" I am not sure whether you are asking for permission or asking whether it will work or not...Of course you have permission to use the code and I am sure it will run o.k., too...just make sure you install the pylab module, too.
 
  • #14
Thank you "gsal" for your reply. I need one more favor from you that is " Can you please give me the file named 'vectors-U.txt' and 'vectors-V.txt' which you used on your pylab module". Actually i have started to learn PYTHON that is why i am facing problems.
Hoping to get reply from you.
 
  • #15
I am not at the computer where I have the files; but, I just simply copied the data from the excel file that you posted into two separate files, one for the x component and another for the y component of velocity...no x-heading row and no y-column, though, just data; the x and y values for the grid I put it together in the python file, as you can see.

By the way, when you pasted the data into excel, you must have messed it a bit...
 
  • #16
Dear 'gsal' thank you for your help. I have finally managed to make diagram. Full credit goes to you. I can use now these type of figure on my paper. Again thank you for helping me.One thing more is there any manuel or user file for python user like fortran or C?
 
  • #17
Of course there is a manual for python...there are plenty. There is a lot of documentation for Python; depending on what distribution you install, it may come with some docs installed locally...otherwise, you can simply consult the on-line manuals.

There are also many books for python and even free ones like Dive into Python.

Python has come a long way on its own merits and is very big within the scientific and engineering community. It is also becoming the scripting language of choice (for scripts, macros, etc) in other applications whether they are free/open-source and even commercial ones.

Learning python is going to be one the best you will ever do for yourself. :-) Keep it up.
 

Related to Drawing Vector Diagrams from Point Data

1. What is the purpose of drawing vector diagrams from point data?

The purpose of drawing vector diagrams from point data is to visually represent the magnitude and direction of a vector quantity. This allows for a better understanding and analysis of the data.

2. What type of data is needed to create a vector diagram?

To create a vector diagram, you need both the magnitude and direction of the vector quantity. This can be obtained through measurements or calculations.

3. How do you determine the scale for a vector diagram?

The scale for a vector diagram is determined by selecting a suitable length for the vector and assigning it a numerical value. This value can then be used to scale the other vectors in the diagram.

4. What is the difference between a vector diagram and a scalar diagram?

A vector diagram shows both the magnitude and direction of a vector quantity, while a scalar diagram only shows the magnitude. Vector diagrams are used for quantities that have both magnitude and direction, while scalar diagrams are used for quantities that only have magnitude.

5. Can vector diagrams be used for non-physical quantities?

Yes, vector diagrams can be used for non-physical quantities such as velocity, acceleration, and force. These quantities have both magnitude and direction, making them suitable for representation in a vector diagram.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
639
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
180
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
201
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Special and General Relativity
Replies
15
Views
603
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
Back
Top