10-27-2011 02:45 PM
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.
10-27-2011 04:50 PM
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
10-28-2011 05:31 AM
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.
10-28-2011 04:28 PM
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
10-28-2011 06:04 PM
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.
11-06-2011 11:03 AM
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.