02-11-2011 03:45 PM
Hi. I am trying to find the center of parabloid. I have come up with a solution, but it does not seem to work on larger arrays so I am wondering what I am doing wrong. Anyways, here is my solution:
Basically, I have a few arrays I am using. I have an array of x-coordinates, an array of y-coordinates, and a 2d array of zvalues. I multiply each z value by its associated x coordinate and then divide by the sum of z values to find the centroid of one axis. And then I multiply each z value by its associated y coordinate and then divide by the sum of z values to find the centroid of the other axis. It seems like it should work, but it doesn't. Anyone have any ideas?
02-12-2011 10:08 AM
What do you mean by the "center" of the paraboloid? As paraboloids are open curves the concept of center is not clearly defined. Do you have a good mathematical model of what you are trying to do?
If your paraboloid is elliptical (as opposed to hyperbolic), you could refer to the "focus" of the parabola which is rotated to create the paraboloid. Is this what you want?
When you say it does not work for larger arrays, what exactly happens? Is the answer wrong? If so, in what way? Does the program crash? Does it produce any error messages?
What do you know about the problem or the data? Is there anything which might constrain the solution or simplify it? For example: symmetry about a known axis, all points positive, ...
If you have not done so, please look at the online tutorials about LabVIEW. The code you posted can be simplified by using the autoindexing feature of the for loops. Since that is on by default you had to disable it. Why?
Lynn
02-12-2011 09:24 PM
Ok so maybe I used the incorrect term. Anyways, it is a parabloid shape but it is bounded. It's like a dome shape basically. The reason I am trying to find this is because I want to basically find the "average" of the shape so that I can automate a test that will decide whether or not the shape is normal or if it irregular. I would use the peak, but the dome can be a little lopsided and still be considered ok.
For larger arrays, the points that are returned by that algorithm are just wrong. I create a cursor on the plot that I am plotting the data to to help give me an idea of where it is saying the centroid is, and for larger arrays (i.e.measurements with more steps taken) the cursor is visibly wrong.
As far as the problem goes:
The x and y axis can both be negative. The z axis can only be positive because it measures power. The graph is not necessarily perfectly symmetrical either. I have a test stage with motors that control the x and y axis. In the labview code, I specify the starting x position and the starting y position. So if I select x to be -6, then the scan will be between -6 and 6 degrees. The same thing is true for the y axis. I also specify the number of measurements to be taken on each axis.
02-13-2011 10:42 AM
I am starting to get a better idea of what you are doing. I think...
Is the shape nominally symmetric for x and y? Is the nominal peak at x, y = 0, 0?
How large are the values at the outer boundaries (6, -6) relative to the values at 0,0?
Do you have a formula or equation for the "normal" shape or a cross section if it is circularly symmetrical?
Can you post some typical data along with what you think the result (for the calculation of the "center" should be)?
Lynn
02-13-2011 02:11 PM - edited 02-13-2011 02:13 PM
There are two flavors of paraboliods, elliptic and hyperbolic.
In any case, these are 2D quadratic polynomials which can be simply fit in 2D using general linear fit using all your data points. Fit to a quadratic plane, then look at the residual and the coefficients. (e.g. check if the quadratic terms are similar, etc.)
Do you have a typical dataset?
In the meantime, have a look at some of my old examples, e.g. 3DPolyFiArrayOutput.zip (from here).
02-14-2011 02:15 PM - edited 02-14-2011 02:16 PM
I have attached a typical dataset (sorry about the ugly formatting. It should be fine if you open it in excel or OpenOffice or something). The algorithm said that the centroid's el position was -0.33007 and that the centroid's az position was 0.367788. However, this is not what I expect. I expect something closer to:
centroid el = .53
centroid az = -.056778
It is more apparent when it is graphed that the centroid is off.
Hopefully this also answers some of the other questions.
02-14-2011 06:19 PM
Hi SegmentationFault,
This seems to be more focused on what you are trying to determine and what mathematical model you are using more so than how to program this in Labview. Could you elaborate more on the center point and how it relates to your application? This would help us determine how it should be implemented in Labview. Also, have you looked at the above posted example?
02-14-2011 06:44 PM - edited 02-14-2011 06:47 PM
The center point is just an automated way to test for correctness. We are building emitters and we basically just want to test that the beam profile is not irregular. In a sense, I guess it could be considered the "three-dimensional average".
Basically, in a perfect world, all of the emitters would have a perfectly symmetrical beam profile with the peak at (0,0). Since we don't live in a perfect world, we want to test that the centroid of the beam profile is +/- some number (we haven't decided yet) from (0,0). We don't want to test the peak because it's acceptable for the beam profile to be a bit lop-sided, so we want to test the centroid.
I looked at the thread mentioned above, and it seems similar. I suppose we could imagine the beam profile to be a plate of varying density, where density could correspond to the measured value of the signal or something.
02-15-2011 09:33 AM
I just had an idea.
Suppose you calculate the points around the profile which represent the half max (peak) value. Fit these data to a circle and check the location of the center of the circle and the tilt of the plane of the circle. You could also do a least squares difference between the data points and the fitted circle. That would be a measure of the "out of roundness" of the profile. The line through center of the circle perpendicular to the plane of the circle would represent the direction in which the beam is pointed in some sense. The center itself might serve as your "centroid."
Lynn
02-16-2011 02:55 AM - edited 02-16-2011 02:56 AM
Well, whatever you have is definitely not a paraboloid.
Here's a quick fit to a 2D gaussian with rotation. It gives the center at [-0.896, 0.704] and the main elliptic axes as [2.31, 2.19] with the major axis tilted by 20 degrees from vertical.
(program adapted from this old post)