ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3D surface local minimum

I need help in creating a faster tuning algorithm.  My setup has two digital/integer inputs (can be called X and Y) and a double (Z) output.  X and Y range from 0 to -40.  My goal is to find the smallest Z value for a given X and Y.  Currently I am doing this by entering 0,0 and then decrementing one (X or Y) and then seeing if the output goes up or down and adjusting accordingly.  This seems a bit brute force.

So, to get a better picture I created a VI that would capture the curve or surface which is what you see in the picture (it shows a peak because I inverted the output/Z value).  What I would like to do is create an algorithm that can find that peak quickly without having to generate all the samples.  I am looking for some sort of 3D surface fit and interpolation but am not having success finding anything.  The Conjugate Gradient nD VI seems promising but I can’t figure out how to use it.  Any help is appreciated!

 

Download All
0 Kudos
Message 1 of 3
(3,169 Views)

Interesting problem. I don't think the typical gradient tools will work well because your x and y are quantized to integers. I'd think it would be possible to adapt a nelder-mead type algorithm to work on a grid. I'll have a look at it... 🙂

 

Is the curve typically similar to your example data (exactly one minimum and the slope gettting steeper towards the minimum, relatively symmetric)?

 

I assume that reading the z value at a given coordinate is the time limited step while jumping to a different position is fast. If moving to a different position is the slow step, a different kind of optimization might be needed.

Message 2 of 3
(3,160 Views)

I can only assume that most devices will have a similar shape.  I only have the one device that generates this surface when plotted.  A bit more detail is that the 0 to -40 are actually setting registers on the device that are controlling some DAC.  I am not sure if it is a literal 1:1 translation of register value to DAC output but the software the accepts X and Y values are inteters.  Then I measure the Z value that is generated.  Setting the register values is relitivley fast and I can jump to any value.  To generate that 40x40 grid took about 10 minutes.

My current alogorith starts sampling down the X axis until I hit a minimum and then switch to the Y axis and repeat steping.  With this shape it works pretty good since there is only the one minimum.  But what I was looking for was to be able to take like 4 measurments at key locations and fit a surface to those points and interpolate a minimum.  Go to that minimum and re-apply a fit and re-interpolate the minimum (repeat as many times to make it more accurate).

Thanks for you help,

Paul

0 Kudos
Message 3 of 3
(3,136 Views)