LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

regression on last 10 data points of a chart

Bascially I collect data every second from a device which is monitoring my experiment. The system takes about 30 second to respond to any changes (to power) that I make. I want my chart to plot 60 secs worth of data for a general overview, but I wish to perform linear regression on the last 10 data points. I will use this trend line to make decision about increasing or decreasing power. I have stripped the VI to the bare bones and have attached it here. I am using the history node, and wish to connect this to the curveFitting.Vi supplied by LAbview. However, I cannot connect the two. I clearly don't know what I am doing, but have to start somewhere.... Thanks for any suggestions, even if its to go and read up on something... Cheers ALex
0 Kudos
Message 1 of 4
(2,373 Views)

Your Express VI is not in the loop.  You must have placed it outside the loop and used the arrow keys to move it over the loop rather than using the mouse to drag it into the loop.

 

Drag to an area outside the loop. Then drag it back in.  Then you can connect it.

Message 2 of 4
(2,328 Views)

Thank you for reply Ravensfan and sorry for my late response.

 

Your advice worked, but then I got the following error from the express VI:

Analysis:  The number of samples must be >= 2.

 

So I have looked at using linearFit.VI and creating a time array from the size of the history property node.

 

It seems to be working , but I should test it today...

Thanks

Alex

0 Kudos
Message 3 of 4
(2,268 Views)

Well, it only worked for a graph plotting one signal... Once there were two or more signals and the history node became a 1D array of clusters, where each cluster was one measurement and the cluster contained 2 or more elements (1 element for each signal) it didn't work.

 

I have the following solution, but its not very neat.  In particular, i would like to know if there is a better way of converting the 1D array of clusters to a simple 2D(2 column in this case) array.

 

Thanks for any advice.

Alex

0 Kudos
Message 4 of 4
(2,243 Views)