From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

regression equation on chart history buffer data

Solved!
Go to solution

Hi!

 

I have a waveform chart with a history lenght of 1024 data points (buffer).

 

Without exporting the file outside from labview, it would be really good if I could calculate a regression line on those 1024 points at the same time I am feeding the chart with new data. Till now, due to the characteristics of my application, I need to wait till I reach "steady state" conditions, then export the chart data to excel, and then make a regression line on that data (i am interested in the slope of that regression line).

 

Could you give some hints about how can I do that regression on labview? Is there any way to store that 1024 points in a buffer and keep calculating the regression line at the same time I get new data to the buffer and to the chart?

 

I hope I expressed myself so you can understand what I meen hehe

 

Thanks in advance

Pablo

0 Kudos
Message 1 of 5
(2,628 Views)
Solution
Accepted by topic author pabgarva

Search the palettes for the function General Linear Fit.  It will do the regression on the data you send it.  Remember that charts basically just take pieces of data, or an array of data.  In order to do a regression, you'll need the X data that goes along with the chart's Y data.  That X data should be equally spaced intervals.

 

You can read the History property node of a chart in order to get the data that is currently within a chart.  Or you can build an array of data stored in a shift register, add new data to it, and remove the old data when the array begins to exceed your desired length.

 

 

0 Kudos
Message 2 of 5
(2,614 Views)

Hi 

 

I am trying with the History property node of the chart. However, the output is an array of clusters, containing as many clusters as buffer size for the chart. Each of those cluster has 2 elements, because I display two "waveforms" in the same chart.

 

How can I get an array containing only the first element of each cluster of the history array (coming from the property node)?

 

Thanks!

0 Kudos
Message 3 of 5
(2,611 Views)
Solution
Accepted by topic author pabgarva

Go to this idea and vote for it.    Why is there no function to reverse "Index & Bundle Cluster Array"

 

What would make it easier to do this the function that is "missing" from LabVIEW.  But the idea also shows you how to do it using a For Loop.

0 Kudos
Message 4 of 5
(2,604 Views)

ok, thanks for the support! 

0 Kudos
Message 5 of 5
(2,576 Views)