03-26-2009 11:24 AM
I have developed this code for plotting the voltage from the PSD(Position Sensitive detector) in terms of position in LabVIEW. It gives me the exact map of the position of the LASER beam on the PSD, on the graph in LabVIEW.
Now what I need to do is calculate out the relative displacement between two positions of the spot. Suppose at time t1 the position is at A(x1,y1) and then at time t2 it moves to B(x2,y2). I know the mathematical formula for the displacement from A to B.
But my problem is how do I get the values of (x2,y2) and the previous position value of (x1,y1) dynamically. I need to do this continously al long as the experiment gos on and then also save it.
Thank You for the help.
03-26-2009 11:35 AM - edited 03-26-2009 11:40 AM
Sounds like a good time for shift registers 🙂
How about something like this:
Compare the current (X,Y) coordinates to the (X,Y) coordinates of the previous iteration.
Then you can build an array of the displacements for each iteration.
That array could make for a nice graph for you: displacement vs time.
Also, just a quick comment on your code:
- you use a lot of dynamic data/signals, this isnt neccessary. You could do the same thing without using the Express VI's, since those are the functions creating that data output.
For example, note, in my VI, I used a Formula node instead of an Express VI for a formula. This allows me to pass data types such as DBL, SGL, I32, etc instead of dynamic data.
03-27-2009 11:45 AM
03-27-2009 11:54 AM - edited 03-27-2009 11:56 AM
Burhanuddin wrote:
Thank You for the reply Sir, but the problem is how do i compare the values of x,y. I am not able to extract the vales from the graph/array for 2 consequtive times.
After you use the 'Split signal' function, right after your 'DAQ Assistant', you should have a signal of X values, and one of Y values.
Convert each of these signals to type DBL. They should now be 1D arrays of type DBL.
Then, you can do the following, since For Loops auto-index:
03-27-2009 12:02 PM
Sir, I think I did not explain correctly.
My x and Y values come after the formula blocks. One formula blocks gives X and one gives Y. so at a certain time we get x1,y1 and then at the next moment we get x2,y2. now with these values I need to find the displacement, using the same formula and continously.
Thank you
03-27-2009 12:11 PM - edited 03-27-2009 12:13 PM
In your attached VI, what is the output of this:
I thought it was an array of x values, or y values.
Is it an array, with only a single point in it?
If so, you will need to build an array of these values.
I can show you what to from there if this is the case.
03-27-2009 12:47 PM
the output of that is an array of the points (x,y), then after that I am seperating the x values and y values and then plotting x v/s y for all the corresponding x and y.
Now what I need to do is that, as the position keeps on changing the (x,y) will also change. I will have an initial position which is constant. With every change I need to measure the displacement of the new (x,y) from the constant original point. Then I have to save these displacement result.
Thank you.
03-27-2009 01:34 PM
Then why does my solution in the first post not work?
After you use 'Index Array':
- replace where I said 'xval' with your 0 index
- replace where I said 'yval' with your 1 index
The rest should work fine.