LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create custom function f(x) for determing values of Y.

Hi I have a question.
I have a set of raw data, obtained from Labview's readings.
From the attached pic,  U might understand from the glance.
Those on the scaled down on HW side,
the readings do not mirror those raw readings on PC side without any added scale factor.
I know something might be wrong with the acquisition card, not NI's.
However, I know the the characteristic or property of that card will not change the readings drastically.
But those readings are wrong. So I am thinking of using the function to correct the readings.
I tried using argsinh(x) function to take in raw readings but it does not mirror those on the real volatge on HW's side.
So how do I come up with the customised function or build function from scratch?
I have been looking for ones in math-related websites but no vain.
I also have attached the data in lvm for your reference.
 
i would be grateful for your help.
 
Clement
Download All
0 Kudos
Message 1 of 11
(4,997 Views)

And pls take a look how the graph would look like if the x values are fed,

Clement

 

0 Kudos
Message 2 of 11
(4,990 Views)

Good afternoon,

 

I am not too sure about why your readings are off – but since it is third-party hardware I’m not in a position to speculate.  With regards to applying mathematical functions and adjustments to your readings – with LabVIEW the possibilities are endless (I know that sounds a little cliché, but it’s more or less the truth).  Are you asking about good mathematical functions to adjust your readings, or are you asking how to implement a known mathematical function in LabVIEW? 

 

If you are looking for how to implement your adjustments in LabVIEW, you can start with some “drop and go” VIs such as “Scaling and Mapping” VI and “Formula” VI.  These are interactive express VIs which can greatly speed up your development through interactive configuration.  There are also a large number of math VIs which can operate on single points, arrays, or waveforms (most of these are located in the “Analyze” palette).  For increased modularity of your code you might also consider making your formula its own subroutine in the form of a sub-VI.

 

Hopefully this helps address some of your LabVIEW platform questions.  Please feel free to provide more information on the specifics of your situation and if possible, I’d be happy to help further! 

 

Thanks for posting!

Travis M
LabVIEW R&D
National Instruments
0 Kudos
Message 3 of 11
(4,973 Views)
Hi Mr Travis M.
I am looking for ways to implement the unknown mathematical function in Labview based on the piot you have seen.
Once the Y values in the known plot are consistent, regardless of the X values, then the function is found.
 
Maybe can you give me tips how to build the mathematical function from the plot?
 
In the meantime I will check with the third party or maybe calibration could be the problem.
 
regards,
Clement
 
 
 
 
0 Kudos
Message 4 of 11
(4,959 Views)

Hi Astroboy

There is an example in the Labview Full Development System upward that will do what I think you want.

With your data it looks like this.

Hope this helps

David

Message Edited by David Crawford on 12-07-2005 06:04 AM

Message 5 of 11
(4,942 Views)

Hi. Thanks alot. This is great tool what I need. Woah So much to rack the brains to obtain the function!

Thanks again!

Smiley Very Happy

Message 6 of 11
(4,912 Views)

Hi So now I have the function obtained for any value of x.

However,  when using the formula node to insert the defined function, there's an error.

I know the ' ^ ' must be changed to **, but it still has error. Could it be 'E'?

What is the proper function for the formula node?

Here's the function:

y = -55.598E+0 + 198.744E+0x - 60.861E+0x**2 + 12.284E+0x**3

so where could it be wrong?

 

Clement

0 Kudos
Message 7 of 11
(4,903 Views)

Clement

Not sure what the problem would be. The formula node looks like this

Notice that y = 120.0 for x = 1.25 is not exactly as you would expect. There is an error. This is because the curve fit is an appoximation. In this case you can decrease the amount of mean square error by increasing the order of the polymonial curve fit.

David

Message Edited by David Crawford on 12-08-2005 01:26 AM

Message 8 of 11
(4,899 Views)

Hi. Thanks. I found your example working.

However when I increase the the number of orders, 19,  

to bring the function such that the evaluated y values almost mirror the raw values.

When I tried to test the built function, It always to match the raw y values.

I checked every details in the formula node and numbers but found them no errorS

Where could it go wrong? Smiley Sad

I am sorry for taking much of your time.  Pls find the attached.

regards

Clement

Download All
0 Kudos
Message 9 of 11
(4,878 Views)

Mmm don't know Smiley Sad

Time to do some experiments. I have attached a VI to help you on your way without confusing you too much, hopefully. My idea was to create the equation calculations in labview so that we can debug the variables. We can't really do that in the formula node. BTW, I couldn't see any issues in your formula node.

So whats in the VI.

You can cut and the paste the equation from the regression solver. I have then setup the vi to parse the equation string which will then allow us to calculate y for any given x. This then gives us a new (x,y) dataset evalutated from your original array. Form there we can graph the errors. This work fine for a bit then goes nuts.

There is a second technique in the file that uses the calculated coeffs (create and indicator to get the data and cut and paste into this vi)  from the Regression Solver.vi for Poly order = 19 based on your original data. It works well.

I have a hunch that its digits of precision giving the problem but I really don't know at this point. Try using General Polynomial Fit.vi to calculate and read the coeffs directly from your dataset.

Interesting problem but I have to get to work Smiley Very HappySmiley Mad . Keep bashing away at it and remember to post back your conclusions. If my code isn't right then please let me know as I haven't fully debugged it as I am trying to get an idea across.

Hope this helps. My head hurtsSmiley Very Happy

David

Message 10 of 11
(4,868 Views)