From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

nonlinear system solver more equations than unknowns

Solved!
Go to solution

Is possible to solve a nonlinear system with more equations than unknowns in LabView. I am doing some triangulation, and have data from several sensors, so I am able to write 6 equations in order to get 3 coordinates (x,y,z) as a solution. In LabView I was able only to solve a system of 3 equations with this 3 unknowns, but I would like to use all of the 6 equations in order to get more accurate solution, since some measurements can be noisy.

 

Thank you in advance

0 Kudos
Message 1 of 10
(4,564 Views)

How would you do this manually? Which equations carry the most weight? How does the system decide?

 

Do you have a way to determine how noisy the measurements are? Are some data points subject to more noise than others? Dose that change from one measurement to the next?

 

My first thought is to solve multiple times using 3 different equations each time. Then combine the results from any sets of equations which generated numerically valid solutions to get the final estimate. The noisiness of the data or the residue of the solutions might be useful in weighting the final combinations.

 

Lynn

0 Kudos
Message 2 of 10
(4,556 Views)

I know Matlab can manage this situation. I used fsolve function for this. I think it is done by changing the solution until all of the equations are satisfied, being less than the preset error.

 

But using Matlab isn't an option for this project.

 

Combining the solutions may work though

0 Kudos
Message 3 of 10
(4,540 Views)

I do not have Matlab but I looked at the Mathworks web site. The documentation page does not list a function called fsolve.  What does your documentation for that function say about more equations than unknowns?

 

Lynn

0 Kudos
Message 4 of 10
(4,516 Views)

Look up "Overdetermined Systems" (which is what you have when you have more equations than unknowns).  There is a technique for finding the least-squares approximate solution to such a system, with the assumption being that your equations are consistent (that is, some of the equations are really linear combinations of others).  LabVIEW should be able to do that, though it might not (natively) use the optimal numeric method ...

 

Bob Schor

0 Kudos
Message 5 of 10
(4,468 Views)
Solution
Accepted by topic author dusan19

You can use the Nonlinear curve fitting code to solve this problem. Consider the following system:

3xy + y - z = 12

x + yx^2 + z = 12

x - y - z = -2

 

Re-arrange to get 0 on right side. x, y, and z are the paramneters to be fit. The Y input to the Nonlinear Curve Fti.vi will be an array of three zeroes. Initial Parameters will be an array of three values, e.g. [1 1 1]. Attached is an example.

-Jim

Download All
0 Kudos
Message 6 of 10
(4,232 Views)
That would work, thank you
0 Kudos
Message 7 of 10
(4,225 Views)

I'm a little confused.  The question you asked was "How do I solve a non-linear system of equations when I have more equations than variables?".  You mention that you know how to solve (in LabVIEW) 3 equations in 3 unknowns.  Several of us ask questions and make suggestions, and you mark as the "solution" solving 3 equations in 3 unknowns.  How does this answer your original question?

 

Bob Schor

Message 8 of 10
(4,193 Views)
But that solition with fitting the parameters can be easily expanded to fitting 3 parameters in more than 3 equations. That is how I understood it.
0 Kudos
Message 9 of 10
(4,181 Views)

DSPGuy can you attach the examples in LabView 2013 version?

0 Kudos
Message 10 of 10
(4,130 Views)