From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding best fit equation for two knows variables

Solved!
Go to solution

@Vindhyachal.Takniki wrote:

Sorry PFA the VI.

 


You change the order of columns. Now the last column is z so you need to rewire the columns coming out of the index array so they are correct. The last column now seems to be Z..

0 Kudos
Message 21 of 34
(918 Views)

After wiring correctly, I get the following for the max deviation:

 

Polynomial Order. dev=x

 

  1. dev=0.18
  2. dev=0.018
  3. dev=0.007
  4. dev=0.006
  5. dev=0.004

 

0 Kudos
Message 22 of 34
(913 Views)

Sir,

 

It simple multiplications of variables only which isnot giving right results.

Labview gives almost zero error +-0.02 which is very good

 

I am saying is that there could be error in selection which degree of plunomoial like x or y or x2y to multiplied with which coefficient. It could be error.

 

Its not even c code, its simple mathematical equation which is giving error.

So must be mismatch 

0 Kudos
Message 23 of 34
(911 Views)

Oh didnt read your last two replies.

Yes i had changed the columns of data, didnt changed any wiring though, since I changed the columns only.

 

Its not even a c code, its simple math equation.

What I suspect we are multiplying wrong coefficent orders with wrong poly factor.

 

 

 

 

void get_value(float32_t x , float32_t y)
{
float32_t x2 = x * x;
float32_t x3 = x2 * x;

float32_t y2 = y * y;
float32_t y3 = y2 * y;

float32_t xy = x * y;
float32_t x2y = xy * x;
float32_t xy2 = xy * y;
float32_t z;


z = (-0.856405103370700971000000f)
+(1.063190618820774920000000f * x)
+(14.209914285379092300000000f * y)
+(-0.001525431973314523430000f * x2)
+(-0.110425437452562752000000f * xy)
+(-0.561650715977711323000000f * y2)
+(0.000112007671458926302000f * x3)
+(0.000361024027398679400000f * x2y)
+(0.002619887991367739200000f * xy2)
+(-0.009204815618802958400000f * y3);

}

0 Kudos
Message 24 of 34
(905 Views)

I don't understand why you keep attaching the same files. Once is enough. If you attach a new and different file, give it a new name. Also please exclusively use zip archives. Not everybody has tools that can open rar files.

 


@Vindhyachal.Takniki wrote:

Yes i had changed the columns of data, didnt changed any wiring though, since I changed the columns only.


Well, if you reassign the columns, you also need to change the wiring.

 


@Vindhyachal.Takniki wrote:


z = (-0.856405103370700971000000f)
+(1.063190618820774920000000f * x)
+(14.209914285379092300000000f * y)
+(-0.001525431973314523430000f * x2)
+(-0.110425437452562752000000f * xy)
+(-0.561650715977711323000000f * y2)
+(0.000112007671458926302000f * x3)
+(0.000361024027398679400000f * x2y)
+(0.002619887991367739200000f * xy2)
+(-0.009204815618802958400000f * y3);


These numbers have no resemblance to the best fit. Where do they come from? I think a handful of significant digits is probably sufficient.

 

Message 25 of 34
(878 Views)

Thanks @altenbach,

A) Able to sort out the issue. Now I got the equation which is +-0.1 error. This is acceptable

Able to make equation for around 1500 data set and they work best for me

 

B) Now I want to extend it to further entire range of sensor data roughly 38000 data-set.

1st column is "z". Second column is "x" . Third column is "y"

Z = Fun(x,y)

 

x is temperature measured

y is voltage measured

 

 

C) PFA two files:

1. test RI_2Dpolynomial.vi

2. test RI_2Dpolynomial-set2.vi

 

Only diff is dataset representation. Dataset is same though

1. First file have dataset arranged in increasing order of temperature("x") i.e 0 to 50 and then again 0 to 50 and so on

2. Second have dataset in which "x" is kept same for 751 readings and then "x" is incremented by 1 and so on

 

Both datasets are same. 

Reason is I think since not good fit model comes out, it seems like need to break data into multiple set points and make equation for each dataset.

 

 

 

 

 

 

 

0 Kudos
Message 26 of 34
(848 Views)

Hi @altenbach,

 

Can u tell?

How to do it?

I have tried to break data into three parts and see equation, but still its very large error fit.

0 Kudos
Message 27 of 34
(826 Views)

You still have xyz wired incorrectly.

0 Kudos
Message 28 of 34
(817 Views)

Once you wire xyz correctly, both arrangement of the dataset give 100% identical results!

You really need to try to understand how all this works. This has been going on for over a week now !:

 

altenbach_0-1593620381254.png

 

0 Kudos
Message 29 of 34
(805 Views)

Hi @

 

 

 

 

 

0 Kudos
Message 30 of 34
(783 Views)