LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can you perform curve fitting to a 2d array and find the maximum?

Hello all,

I am working with a 2D near field range positioner and need to calibrate its position to find the maximum S21 point(s). If you don't know what that means, it doesn't matter.

What does matter is I have a 2D array in labview of floating point data which I would like to fit a continuous curve to and find the maximum point(s). Is there a VI out there that someone has developed for such a problem? Or if someone had an idea of a way to go about getting what I need I would greaty appreciate the help.

Cheers
0 Kudos
Message 1 of 32
(10,473 Views)
The only S21 I'm familiar with is the S21 for network analyzer measurements. Be that as it may, I'm suspecting your 2D array is either 2 rows or 2 columns, meaning that one row/column is the "X" data (independent variable) and the other row/column is the "Y" data (dependent variable). In that case, you just need to index out the individual rows/columns to feed to the curve fit functions:



To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.


Message Edited by smercurio_fc on 06-26-2008 03:47 PM
0 Kudos
Message 2 of 32
(10,464 Views)
What I have is an 11x11 array (going to grow to some X by Y) which I'm essentially trying to turn into a 3D graph using the data in the array as the dependent variable. Once I have a continuous multivariable graph I would like to find the maximums in it.

I alpologize, but I am unsure what you placed in the above example.
0 Kudos
Message 3 of 32
(10,454 Views)
What I placed above was the Index Array and the polynomial curve fit VI. As I indicated, it would probably be good for you to spend some time with the LabVIEW tutorials.

It seems that you have 3D data. That's different. A curve fit is for 2D graphs, not 3D graphs (unless you're looking at slices). Can you provide a sample of your data, and what should be found?
0 Kudos
Message 4 of 32
(10,448 Views)
A file of some data is attached. Looking at the data is similar to looking at the 2d positioner we have. Columns represent changes in the X axis, rows represent changes in the Y axis. What I'm doing is moving the positioner a discrete distance and taking a measurement. After I would like to fit a continuous curve to it and find the maximum so I can move the positioner to its (X,Y) coordinate.
0 Kudos
Message 5 of 32
(10,426 Views)
I plotted your data, and this is what I got:



What am I looking at, and what are you looking for?


Message Edited by smercurio_fc on 06-27-2008 10:06 AM
0 Kudos
Message 6 of 32
(10,399 Views)
This is just a file of some S11 parameters out of a network analyzer (measuring nothing useful) for test purposes. What I will be doing in the end is measuring S21 parameters out of a network analyzer looking for the local maxima which will designate where an antenna patch is placed (or at least that's the plan).

So basically I am writing this as a scan and locate antenna patches function. I start off with a descretized scan of the 5 ft by 5 ft area taking measurements at each point, write the data into a spreadsheet type file, and I'm hoping i can extrapolate local maxima of what would be a continuous function.
0 Kudos
Message 7 of 32
(10,388 Views)
I haven't played around with it too much, but you may find the example given here useful as a starting point. It is an example to do a polynomial fit for 3D data. The example will provide you with the coefficients for the polynomial fit.
0 Kudos
Message 8 of 32
(10,371 Views)
First you need a mathematical model to describe your data.
 
If you just want to fit to a 2D polynomial (e.g. Z=  A x +  By + Cx^2 + Dxy + Ey^2 ...) You could do something like here:
 
 
(Since your xy data forms a regular grid, it is even easier)
 
 
If your model is more complex, (e.g. a 2D gaussian over a 2D polynomial background), You can use Levenberg Marquardt. I made a simple demo for NI week, see picture:
 


What is your LabVIEW version?

Message Edited by altenbach on 06-27-2008 09:52 AM
Message 9 of 32
(10,370 Views)
Wow, that looks precisely like what I was looking for. Thank you.

I'm using LabVIEW 8.5, just started using it last week, but it's very intuitive, and am picking it up fairly easily.
0 Kudos
Message 10 of 32
(10,363 Views)