11-19-2021 02:47 AM - edited 11-19-2021 03:35 AM
I have 3 Arrays
----------------
x y z
----------------
0 0 1.62
5 1 2.25
10 2 1.4
15 3 0.95
. . .
. . .
. . .
. . .
Each x, y pair represents z intensity value like (0,0)-> 1.62 and (5,1)-> 2.25. The x array is in multiples of 5 up to 10540 and y array is up to 2047 so both arrays are of size 2048
I need to make 2D array of these x, y pairs which stores the respective z-intensity value to plot on Intensity chart.
I have found this but unable to understand
Help with XY intensity graph - NI Community
EDIT: sometimes the y values goes to negative side like (5,-0.9)->1.47 then how to array 2d array and how to plot negative side on y axis.
11-19-2021 03:03 AM - edited 11-19-2021 03:03 AM
What part didn't you understand? Seems simple enough!
If you want specific help, attach a simplified VI containing a typical dataset of xyz.
11-19-2021 03:36 AM
i have attached my vi with data
11-19-2021 09:33 AM
@sheshu9a1 wrote:EDIT: sometimes the y values goes to negative side like (5,-0.9)->1.47 then how to array 2d array and how to plot negative side on y axis.
You'd linearly scale the values. If the graph is 0-1999 pixels, linearly scale so the minimum value becomes 0, the max becomes 1999.
Something in the lines of:
Ygraph = (Y - Ymin) / (Ymax - Ymin) * (width-1)
11-19-2021 10:22 AM - edited 11-19-2021 10:48 AM
@sheshu9a1 wrote:
i have attached my vi with data
Well, that has nothing to do with the original question, because you now use rcos and rsin as x and y and these are NOT integers!
Maybe you want to explain why you generate 9 different datasets and overwrite them in the intensity graph as fast as the computer allows, leaving you with only the last set? Seems pointless.
In the original problem, x and y are linear ramps of integers! (0,1,2,3, ... or 0,5,10,15, ... resp.). What happened to that?
Why exactly are you using an intensity chart instead of an intensity graph??? Do you know the big different?
11-19-2021 10:49 AM
I have cleaned up your code a bit (No chage in functionality, but replaced chart with graph) and here's how it could look like:
11-20-2021 02:57 AM
Hi, thanks for your reply
I have a data acquisition card which gives intensity values (1d array of 2048 size). I am trying to represent angle values of gimbal (azimuth and elevation) the X-axis is azimuth and Y-axis is elevation. The bin(index) number of intensity value array gives the range the formula goes like this X-axis = rCos(angle) Y-axis= rSin(angle). Both the X and Y axis go negative range in certain angles. So far I have tried this, the XY graph in the vi is the data i want to have in intensity graph (i.e; represent the intensity values in that particular angle).
11-21-2021 01:30 AM - edited 11-21-2021 10:05 AM
So does it work they way you want?
(Still seems overly complicated. You have only 2048 points so there is a lot of redundancy (e.g. the point at 0,0 gets overwritten by the same value 2048 times!) AND you have gaps between the rays (i.e. pixels that never get hit).
Maybe you want to iterate over each pixel, get the distance from the origin, and color it accordingly...)
11-21-2021 01:43 AM - edited 11-21-2021 10:07 AM
@altenbach wrote:
Maybe you want to iterate over each pixel, get the distance from the origin, and color it accordingly...
Here is a quick example for that. Note that the use of "interpolate array" will do a linear interpolation for fractional indices.
11-21-2021 01:50 AM
... and if you subtract 1024+1024i right before taking the absolute value, you can even center the data. 😄