LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Ensure quadratic coefficient negative

Hello,

 

Would someone perhaps be able to suggest as to how I could ensure that 2nd order terms of my quadratic functions are constrained to be less than or equal to zero without me having to explicitly write a fixed value, such as '-4' for example?

 

The attached vi (LabVIEW 8.5) seeks the maximum velocity between three (equally dimensioned array) stations by fitting 2nd order polynomials and then reporting the mean flow angle by setting the first derivative to zero.  I appreciate that I haven't extensively gone into the background of what I'm doing but it seems to work well as is but it could do with some improvements for more challenging cases.

 

Thanks.

---------------------------------------------------

LabVIEW 8.5 User.
0 Kudos
Message 1 of 6
(3,024 Views)

I am not sure what you are asking.  If the data produces a positive coefficient for the quadratic term, perhaps it would seem to indicate that a problem exists for that data set.  In your example all the quadratic coefficients are negative although the first few are close to zero.

 

Lynn

0 Kudos
Message 2 of 6
(3,013 Views)

You are correct to point that out.  There are issues with my other data sets but this is limited to when y tends towards 0.  I have a feeling that if I forced a negative 2nd order coefficient then the scatter would be lessened for finding the point of symmetry.

 

I have used cosine functions as alternatives and encountered different issues in the same region.

---------------------------------------------------

LabVIEW 8.5 User.
0 Kudos
Message 3 of 6
(3,002 Views)

When you get "strange" results from a fitting routine, it is often a clue that the model you are using does not correlate with the underlying physical process.

 

Since both quadratics and cosines do not work in that region, you probably need a more realistic model.

 

It appears that the questionable data appears when the master/slave data values are less than 1.  I also notice that the column 0 coefficients are exactly the same as the Master values (within the display resolution).  I changed the station angles so that none was zero (0.873, -0.873, -0.785). This is approximately a 5 degree rotation.  When I do this the curve on the XY  Graph is inverted but the angle values are in the range of -19.5 to -23.0.  None are close to zero.  The column zero coefficients are similar to the Master values but not the same.

 

Here is my version.  Note that I cleaned up and simplified some of the calculations.

 

Lynn

0 Kudos
Message 4 of 6
(2,992 Views)

It might not be available in LabVIEW 8.5, but in newer versions you can give parameter constraints. You are doing a quadratic fit with three points at a time, so the fit will always be perfect. Why mess it up with parameter constraints?

 

Do you have a model for the final function? Maybe you can do a 2D fit of the entire data to some model eliminating the intermediary polyfit.

0 Kudos
Message 5 of 6
(2,986 Views)

Thanks everyone for your replies.  I've been busy with other things and it will be a couple of weeks before I can get back onto this.  Once I have the time I'll upload some of the more challenging cases where I'm running into deeper trouble.  Speak soon.

---------------------------------------------------

LabVIEW 8.5 User.
0 Kudos
Message 6 of 6
(2,957 Views)