LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3D vector plot of complex numbers

Hello,

 

I would like to be able to plot a series of complex numbers  as arrows along an axis in "3D".

Much like this image attached.

 

Ive been able to use 3D plots to draw the tips only of the vectors(complex numbers) in 3D space, but i'ld rather have them like arrows, rotating according to phase...as in the attached picture.

 

Could someone suggest the best approach ? Examples ?

To use existing 3D plots, or draw arraows in a picture, then convert it to "3D" perspective ?

 

It would also be helpful to be able to move it about in 3D...so as to inspect certain parts.

 

Any help would be appreciated.

Thanks.

 

===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+ and DXIQ, ESSB for NI ELVIS III and myDSP for myDAQ to learn Wireless Telecoms, Signals & Systems, Fiber Optics and Green Energy principles (www.emona-tims.com)
0 Kudos
Message 1 of 7
(3,244 Views)

Ive taken a look at the Quiver plot example and tried to break it down to suit my purpose.

 

However I dont understand the inputs to the Plot Helper.

 

Can someone explain these..as I cant see the relation between the inputs I've randomly created as constants and the quivers drawn.

 

Ive attached my experiment (LV2012)

 

Thanks.

===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+ and DXIQ, ESSB for NI ELVIS III and myDSP for myDAQ to learn Wireless Telecoms, Signals & Systems, Fiber Optics and Green Energy principles (www.emona-tims.com)
0 Kudos
Message 2 of 7
(3,234 Views)

Hi,

To put this question more simply...in the hope of getting a reply..

 

Could someone explain how to use a 3D quiver plot to draw 3 arrows from say:

 

(0,0,0) to (1,1,0)

(0,0,1) to (2,2,1)

(0,0,2) to (-3,3,2)

 

This would be 3 arrows, from a common baseline, the z axis, and pointing upward at various angles.

 

I can then extend this example to suit my application relating to multiple complex numbers.

 

Thanks for any suggestions.

===============================================================

Take a look at DATEx, FOTEx, HELEx & SIGEx add-in trainer boards for NI ELVIS 1,2 & 2+ and DXIQ, ESSB for NI ELVIS III and myDSP for myDAQ to learn Wireless Telecoms, Signals & Systems, Fiber Optics and Green Energy principles (www.emona-tims.com)
0 Kudos
Message 3 of 7
(3,135 Views)

Hello Carloman, 

 

I would suggest taking a look at the following link:

 

3D Quiver Plot Helper VI

http://zone.ni.com/reference/en-XX/help/371361H-01/lvpict/3d_quiver_plot_vi/

 

Best wishes!

Amanda B.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(3,115 Views)

The quiver plot example is useless. Since the source of the data is not explained, I have no idea how this vi works. NI has had questions like this for years about the quiver plot, and no one answers the questions other than to say look at an example that is not helpful. Someone needs to add text to the example to explain how to format the XYZ data into matrices or 2D arrays.

0 Kudos
Message 5 of 7
(1,519 Views)

The example is indeed pretty terrible. I'd recommend starting with a bunch of empty grids and playing around with sample data to see what changes.

 

The Vector mode plot uses a 2D array for the Z height of the surface. If X and Y are empty, then it assumes 0, 1, 2, etc. Otherwise, X and Y describe the X and Y coordinates of z(x,y).

 

The Nx, Ny, and Nz inputs contain the x, y, and z sizes of the arrows in the Z grid. In other words, Nx(x,y) is the x length of the arrow pointing to z(x,y). Unfortunately it looks like their lengths are statically determined, which seems silly to me but who knows. As best as I can tell the arrows use the unit vectors described by Nx, Ny, and Nz, not the actual values themselves. Again this seems dumb (you generally want to see the length of the vectors on this type of plot) so I don't know if I'm just missing something or what.

 

Right click on it and select "3d plot properties" for a lot more properties that will, for example, let you turn the surface off to just get vectors.

 

Edit: The matrix version has a similar 2D grid for X and Y. X(i, j) corresponds to the x location of the point at z(i, j). The vector version assumes that all x values are the same for a given row, whereas the matrix version assumes that each point is different. Bit of an odd way to look at things but I suppose it makes sense.

 

What it does look like though is that the quiver plot doesn't do what the OP wants it to, unless all arrows happen to be the same length.

 

I'd try the Advanced Plotting Toolkit. I don't think it's actively supported though so it might not be super easy to use.

Message 6 of 7
(1,484 Views)

The Advanced Plotting Toolkit is actually a very nice API wrapped around (a pre-2015) Python and the Matplot Package.

 

So, you might as well just learn how to render a 3d Quiver Plot (or 3d vector field...) directly e.g. start with

https://matplotlib.org/stable/gallery/mplot3d/quiver3d.html

 

assuming you want to render something as the original OP discribed in the first message

 

 

 

alexderjuengere_0-1647727517694.png

 

 

 

Spoiler

import matplotlib.pyplot as plt
import numpy as np

ax = plt.figure().add_subplot(projection='3d')

# Make the grid
z = np.arange(-90,90)
x = np.zeros(180)
y = np.zeros(180)


# Make the direction data for the arrows

w = np.arange(-90,90)/30
u = np.sin(3*w)
v = np.cos(3*w)



ax.quiver(x, y, z, u, v, w, length=0.05, normalize=True, linewidth=0.75, linestyle=(0,(1,1)) )

plt.show()

 

 

 

0 Kudos
Message 7 of 7
(1,476 Views)