LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Nonlinear Equations

Solved!
Go to solution

Hello,

 

Is there a way to solve two nonlinear equations and find x and y from them using LabVIEW without MatLAB and MathScript (don`t have ones on the lab PC)?

Maybe someone has an example..

 

Equations.jpg

 

Thanks.

0 Kudos
Message 1 of 11
(5,431 Views)

You should be able to do this with the nD Nonlinear System Solver.vi from the Mathematics >> Scripts & Formulas >> Zeros palette.

 

Can you post some typical values for the parameters and the expected values of x and y for those parameter values?

 

Lynn

0 Kudos
Message 2 of 11
(5,368 Views)

Hi! Thanks for your answer.

 

Parameters change from test to test (especially time), but average values are: v=5900 m/s; t2a=0.00001 s; t2b=0.000015 s; x1=0; y1=2000; x2a=3000 mm; y2b=0.

 

Expected values of x and y are [800, 1000].

 

I tried to play with nD Nonlinear System Solver.vi basing on several examples that I managed to find. However, all my attempts were unsuccessful - x and y are always zeros. Cannot find a mistake..

 

0 Kudos
Message 3 of 11
(5,360 Views)

So this is what I tried to do, but answers always are zeros. Another question is how to automate the input variables using this VI..

 

question.jpg

0 Kudos
Message 4 of 11
(5,352 Views)

When I use the VI version of the nonlinear solver I get x= 1500 and y = 1000 for the values which you say should yield 800, 1000.  I have not double checked the implementation of the equations.  

 

In the VI version of the solver I pass the parameters as an array to the Data input.

 

What version of LV are you using?

 

Lynn

0 Kudos
Message 5 of 11
(5,342 Views)

I`m using LabVIEW 2013. 

Sounds good, at least you have got no zeros 🙂 Is the right side of the block diagram correct? I`ll try one more time with an array of input parameters..

0 Kudos
Message 6 of 11
(5,316 Views)

I don`t know why all data I insert in front panel elemets (formulas, variables and start data) disappears when I access the file after saving it. 

I have got error -23001, but I think that syntax of functions is correct.

 

Functions are :

sqrt((x-3000)^2+y^2)-sqrt(x^2+(y-2000)^2)-5900000*0.00001

sqrt(x^2-y^2)-sqrt(x^2+(y-2000)^2)-5900000*0.000015

 

question.jpg

0 Kudos
Message 7 of 11
(5,307 Views)

You need to right click on the controls and pick Data Operations >>  Make Current Value Default if you want those values to be there after saving and reopening the VI.  Alternatively,  click the Edit menu and pick Make Current Values Default to do all the controls on the VI at once.

0 Kudos
Message 8 of 11
(5,290 Views)

Thank you very much! It works)

 

I still have error -23001. What do I do wrong?..

0 Kudos
Message 9 of 11
(5,282 Views)
Solution
Accepted by topic author Ivan899

When I ran your VI, I got error -23023. When I enter that into Explain Error, I get Wrong dimension on Start. Error -23001 is a syntax error. In your second equation you have sqrt(x^2  -  y^2) while the equation in your initial post has a +, not a -.  That does not give me a syntax error but it does prevent finding a zero.

 

The reason for error -23023 is that you have specified Start but not End. Creating a control for End and entering two values immediately finds a zero at 1518.178612...

 

Here is the VI I used.  You may need to relink the reference to the function VI because it will be in a different location.

 

Lynn

Download All
0 Kudos
Message 10 of 11
(5,256 Views)