LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Laser Beam Width using second Moment Width

Solved!
Go to solution

Hi,

 

Yes, When I am dividing the sum from intensity. That portion i am confused about. should I have to use total intensity or area under the curve?

 

Thanks

0 Kudos
Message 11 of 17
(1,054 Views)

As I said, first, you need to fix the race conditions (=get rid of ALL local variables! *). Where does the "intensity matrix" control get it's data and how does its data differ from the values in the "input array"?

 

What are the formulas?

 

* A "literal" rewrite of your code without race condition could e.g look as follows, but first you should verify the math. For example the centroid coordinates first need to be obtained in a similar fashion. For simplicity, I left out the scaling operations applied to the sum. later. (The code in the picture is definitely NOT right, but just illustrates how the code should be written in general. Think dataflow! For example, in your code, the local variable on top will get read way before the bottom code has a chance to update the indicator and this will get values from the previous run. Same for all other locals. You'll get an unpredictable mix of current and stale values.). 

 

Second.png

 

 

 

Compare with your garbage code for that same part (simplfied by removing the pointless sequence structures and local variables and skipping the scaling operations):

 

NoSeconds.png

 

0 Kudos
Message 12 of 17
(1,047 Views)

Hello,

 

Thanks. I am approaching form matrix side but good to have an idea from array side. 

 

Just one last question if I want to find individual X and Y values for the below equation. Sigma_X^2 and sigma_Y^2. 

 

Could you give me an idea from array side approach?

 

 

Thanks,

 

0 Kudos
Message 13 of 17
(1,033 Views)

@sspp07 wrote:

 

Thanks. I am approaching form matrix side but good to have an idea from array side.  


Sorry, I have no idea what that means. Where is the matrix data coming from and how does it relate to the values and size of the "input array" control? (In your example code, it's an empty matrix!)

 


@sspp07 wrote:

 

Just one last question if I want to find individual X and Y values for the below equation. Sigma_X^2 and sigma_Y^2. 


X and Y are the independent variables, and thus inputs, not results. Nothing to "find". In your case, x and y are the 2D array indices. These integrals can all be replaced by sums. Seems trivial to implement given the code skeleton I gave you earlier.

0 Kudos
Message 14 of 17
(1,028 Views)

I have to solve this formula. For individual X & Y Direction. 

 

 

0 Kudos
Message 15 of 17
(1,009 Views)

The formula is already solved. You just need to implement it. We already showed you all the tools.

0 Kudos
Message 16 of 17
(987 Views)

See if this is what you want. Axis units are in pixels, so scale as needed.

 

(note that for performance certain duplicate operations could be eliminated using extra loops. Not shown. The compiler might already do some of it anyway)

 

 

0 Kudos
Message 17 of 17
(980 Views)