# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Re: Laser Beam Width using second Moment Width

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

Message 11 of 17
(380 Views)

## Re: Laser Beam Width using second Moment Width

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.).

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

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 12 of 17
(373 Views)

## Re: Laser Beam Width using second Moment Width

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,

Message 13 of 17
(359 Views)

## Re: Laser Beam Width using second Moment Width

@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.

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 14 of 17
(354 Views)

## Re: Laser Beam Width using second Moment Width

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

Message 15 of 17
(335 Views)

## Re: Laser Beam Width using second Moment Width

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

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 16 of 17
(313 Views)

## Re: Laser Beam Width using second Moment Width

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)

LabVIEW Champion. It all comes together in GCentral
What does "Engineering Redefined" mean??
Message 17 of 17
(306 Views)