LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I have a function Z, dependent on two variables Xand Y, and i need to find the values of X and Y for which Z is a minimum.

I have a function Z, dependent on two variables Xand Y, and i need to find the values of X and Y for which Z is a minimum. Could anyone please provide me some optimization tool and clealy communicated steps on how to do this. I have looked at some of the optimization tools but dont quite understand how to achieve this task using them. Basically I am expecting something similar to a basic excel solver where a certain "goal" is achieved  by "changing cells". in essence my VI has a number of operators involving X and Y wired to achieve Z. What i need is to wire the points X, Y and Z to some terminals of a Vi which will yield the optimal values of X and Y required to achieve a minimum of Z. 

 

 

[BADGE NAME]

0 Kudos
Message 1 of 9
(4,608 Views)

Can you write type of your function?
You have equation or set of values?

0 Kudos
Message 2 of 9
(4,558 Views)

Wont be easy to specify the equation but I clearly have 3 points on the Vi that represent or correspond respectively to  X,  Y, Z. so i am looking for an optimization VI which wil take in X and Y, produce a minimum Z and then tell me which combination of values of  X and Y yielded that minimum value of Z


 

[BADGE NAME]

0 Kudos
Message 3 of 9
(4,553 Views)

Thanks but i would need X and Y to be two separate inputs and they are single elements not arrays or waveforms. Z also should be a single element.

 

Let me know if you have a solution of the form described above.

[BADGE NAME]

0 Kudos
Message 5 of 9
(4,532 Views)

Artem's code provides the single element where the Z value is the least.  Now all you need to do is unbundle that cluster to get the X, Y, and Z values.

0 Kudos
Message 6 of 9
(4,524 Views)

Either you don't understand what it means to minimize a function Z dependent on two variables X and Y or else you haven't clearly defined the question you are asking of us.  It usually help us (to help you) if you post some LabVIEW code so we know what you've tried, or in this case, tell us how to get Z if we give you X and Y.

 

Some of the suggestions mentioned take you at your word that you don't have a real "function", but rather a set of X, Y, Z triples and want to find X and Y that minimize Z.  In "minimization theory" (a term I just invented), this is related to the method called "Grid Search" -- you simply check all of the (X, Y, Z) triples, find the one with the smallest Z, and return the associated X and Y.

 

When dealing with mathematical functions, however, it is often not so easy.  What is meant by a "minimum"?  What happens if there are several "minimums"?  How do you efficiently find the minimum (without testing every point that there is, and there are really a lot of them on the X-Y Plane)?  

 

Note that if you really do have the function as f(x, y) = z, you can always use Calculus to try to come up with a formula for the minimum ...

 

Bob Schor

0 Kudos
Message 8 of 9
(4,502 Views)

Bob, Thanks very much. I believe you have a firm grasp of the problem here. I have successfully used calculus for some single variable problem but since this is two variables I am not sure it is quite possible. I believe this requires an iterative approach. Calculus offers faster results so that would naturally be my approach if Z were dependent on only one variable. 

[BADGE NAME]

0 Kudos
Message 9 of 9
(4,493 Views)