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: 

how to use regression

i have a two data which forms a cluster of two elements, which in turn is then connected to a graph. However, the line plotted in this graph is not the best fit line. Hence, i decided to include regression. However, there is always the problem that my original data is of dimension 1 and the regression sub-vi is asking for a 2D data. When i insert build array, it does not seem to solve the problem. So, how do i solve it?
0 Kudos
Message 1 of 3
(2,561 Views)
Hi Adeline,

if you are using a 1-D line fitting algortihm, then it should be asking for two 1-D arrays. One is the X-array, and the other the Y-Array. If you have a single set of data which is equidistant, beginning with zero, then you can "manufacture" an X-Array with a simple for-loop.

Since it sounde like you're plotting on an XY graph, you should already have X- and Y-Values in your code. Try connecting them both up as 1-D arrays. If this doesn't work, look for a 1-D line-fitting VI.

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 3
(2,556 Views)
Hi Adeline
Besides best fit, there are other solutions that can work fine with your data.
Try smoothing, you can download a vi from www.sciware.com.au (Savitzky-Golay smoothing filter for non-uniformly spaced data. )

Hope it helps
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 3 of 3
(2,545 Views)