04-17-2015 06:11 AM
From measurements I’m having 4 sets of pressure and corresponding flow.
Plotted in a XY-plot, the curve follows the form
y=ax2+bx, where y is the pressure and x is the flow.
I need to get the values of a and b, and R2.
The curve have to cross in x, y= 0,0.
From the math palette I can see that Labview offers a bunch of different regression possibilities, but which to use and how?
Can anybody help me?
Regards Michael
Solved! Go to Solution.
04-17-2015 06:15 AM - edited 04-17-2015 06:20 AM
04-17-2015 07:06 AM
Yes you are right.
Am I right, when I say that there a no exact way to ensure that the curve cross in x,y =0,0 ?
When using the weight, I thought that if I give the values 1,1,1,1, 1000 it would ensure x,y through 0,0.
But I found that too high a weight for 0,0 gives values far from 0,0.
The weight have to be high but not to high
But do I have to play for every new set of data, then it’s no good.
What do you think?
R2 is that the residual value or the error?
04-17-2015 07:09 AM - edited 04-17-2015 07:11 AM
Hi Michael,
When using the weight, I thought that if I give the values 1,1,1,1, 1000 it would ensure x,y through 0,0.
When reading the help for the function (as you should always do as a beginner) you would have noticed the acceptable range for weight values…
R2 is that the residual value or the error?
You should know on your own what you need to calculate. Don't you?
Usually there is a residual value R - or it's squared value R²…
04-17-2015 07:26 AM
I read about the weights and only found this:
"Weight is the array of weights for the observations (X, Y). Weight must be the same size as Y. If you do not wire an input to Weight, the VI sets all elements of Weight to 1. If an element of Weight is less than 0, the VI uses the absolute value of the element. "
Not anything about at max value
04-17-2015 07:28 AM
04-17-2015 09:44 AM
Now I read the documentations for the function (as you advised me) one time more and found a very useful control.
With the “Coefficient Constraint” you are able to control that the curve crosses in 0,0.
As I mentioned the function have the form
y=ax^2+bx+c,
but since the curve should cross in (0,0) , c have to be 0. Therefore the constrain for coefficient 0 should be 0.
And it works
Thanks for your help.
04-17-2015 02:31 PM - edited 04-17-2015 02:32 PM
Michael.Koppelgaard wrote:As I mentioned the function have the form
y=ax^2+bx+c,
but since the curve should cross in (0,0) , c have to be 0. Therefore the constrain for coefficient 0 should be 0.
Better would be to setup the simpler system with only the a and b terms, then use General linear fit to solve it.
04-17-2015 03:15 PM - edited 04-17-2015 03:16 PM
@altenbach wrote:
Better would be to setup the simpler system with only the a and b terms, then use General linear fit to solve it.
Here's what I had in mind.
04-18-2015 02:18 AM
Ahh - you can also use linear fit. Funny… the name suggests that it have to be a linear function.
I will most certainly try it out later this weekend.
Thank you for your advice.