LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for logic to find value of m and c from this equation y = mx + c.

Solved!
Go to solution

Hello,

I have 4 points for example xi=3.38276, 0.375866 

                                        yi=3.37749, 0.281924

by using this points I want to find the value of m and c.

Will you please suggest me some logics to solve this equation by using labview programming.

I tried with one solution but in that case I didn't get correct answer. Here in attachment there is vi by using that I tried to solve my equation but in that case what ever value I got as an answers its not satisfied the equation, means if I replace value of m and c in that eqation then it should be L.H.S = R.H.S, but i didnt get the right solution.

Will you please guide me.

Thank you very much.

0 Kudos
Message 1 of 7
(3,238 Views)
Solution
Accepted by topic author AnkitRamani

Why do you think the results are incorrect? I put your numbers into you code and ploted the result on an XY Graph, I then overlayed that with more than 20 values with an x value ranging from 0.6 to 3.2 and use the factors calculated in your code to generate the Y values. The two overlay almost precisely...

 

Mike...

 

BTW: There is a linear fit VI built into LV.


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(3,224 Views)

Yes, I tried it too.  Your code looks correct.  But, as Mike said, LV has a built in function that will save you some time.

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
0 Kudos
Message 3 of 7
(3,221 Views)

i think problem is solved....if i do by given attachment then i got correct answer...

0 Kudos
Message 4 of 7
(3,217 Views)

What happened?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 7
(3,213 Views)

thank you very much for quick suggestion....

0 Kudos
Message 6 of 7
(3,209 Views)

Hello,

 

I am facing some problem regarding to write the value of C on my modbus Register.

Can it possible to set C Value at 0 and according to that I have value of m ,so its good for the program in order to write 0 Value in modbus register.

Will you please let me know if any suggestion is there.

 

Thank you very much in advance.

0 Kudos
Message 7 of 7
(3,109 Views)