LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

algorithm to find vertex of a parabola

Solved!
Go to solution

Use case: trimming Common mode rejection using a programmable potentiometer

 

Problem: The performance of each circuit varies greatly and searching for optimal value (lowest CMRR) gives erroneous results. The performance  seems to be relatively flat on some circuits,steep on others. By starting in the middle of the potentiometer's range and moving up or down I compare the measured value after changing the potentiometer to the last measured value. In doing this I can search for the lowest CMR. 

 

Setup: 5V 60Hz sign wave input to the positive and negative sides of a differential ADC. The potentiometer is trimmed and the common mode noise reduces. Go to far and the common mode noise goes up.

 

Question: I would like to use curve fitting to calculate the shape of the of the CMR performance. Take several measurements (no more then 10 hopefully). Fit the x,y (x= potentiometers trim setting 0 to 1023, Y = amplitude of the measured common mode signal). Find the vertex.

Is this possible and can someone point to an example.  I have not found one.

0 Kudos
Message 1 of 6
(3,440 Views)
Solution
Accepted by topic author BeanBoy

A parabola is the curve of a second order polynomial.  The vertex should be at the peak value.  Use the General Polynomial Fit.vi to fit your data. Use the Polynomial Coefficients outputs to calculate the peak location using a bit of analytic geometry.

 

Edit: Note that you may need to do some checks to make sure that your data has not generated some other curve tahn a parabola.

 

Lynn

Message 2 of 6
(3,415 Views)

Thanks Lynn for the direction.  I have looked at the examples for the general polynomial fit.vi and understand its use.  I have written my own vi and put in clean data and recieved the expected vertex out.

 

How would you check to make sure you haven't produced some other curve then a parabola?

 

0 Kudos
Message 3 of 6
(3,372 Views)

A search of Wikipedia for "parabola" yields this definition:


 

 A x^{2} + B xy + C y^{2} + D x + E y + F = 0 \,

with the parabola restriction that

B^{2} = 4 AC,\,

 

Because of the process you are using to generate the data, you probably know that the parabola will have an axis which is vertical (or horizontal).  In those cases there are simplified equations.  The general equation without the restriction can generate an ellipse or a hyperbola.  If you can use the knowledge of your system to guarantee that one of the simpler equations is always valid, you may not need the other checking.

 

Consider the case where the potentiometer is defective and does not change value. Your data may fall perfectly on a straight line rather than a quadratic curve.  The curve fitting may produce a curve with the coefficient of the second order term very close to zero.  That could produce large errors in the apparent position of the vertex.

 

Lynn

0 Kudos
Message 4 of 6
(3,351 Views)

Thank you Lynn. It has been a long time since I done anything mathematically more complicated then my taxes.

 

I am measuring a parabola with horizontal symmetry. I have added fault checking to my code but wont get around to checking it until Monday.  That said I have run it through on 3 seperate devices 10 times each and have repeatable results. Yeah.

 

Thanks again.

 

 

0 Kudos
Message 5 of 6
(3,344 Views)

A parabola is more complicated than your tax return???

 

You may not need the error checking, but it is important to at least think about it.

 

Lynn

0 Kudos
Message 6 of 6
(3,331 Views)