LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

lineair fitting from measured signals

Hello all,

 

I am trying to implement a lineair fitting of signals while running the VI. I am interested in the scale of this fitting, because I want to use it as a stop condition. Unfortunatelly I cannot get this working. Can anybody help me out with this? Thanks in advance.

 

 

0 Kudos
Message 1 of 4
(2,556 Views)

OK, so I don't understand what you're trying to do with the for loop, but here's what it does:

 

You take the first samples of the first two channels from DAQmx and then build an array of "number of samples in array" -times those same values and pass it to the function, so they probably look like this:

 

X = [333333333]

Y= [444444444]

 

which to the function is 9 times the same point. Accordingly it should not give you any values that make sense. A line is defined by 2 points.



Remember Cunningham's Law
0 Kudos
Message 2 of 4
(2,511 Views)

Hello PeterFoerster,

 

Thanks for you answer. The program I've uloaded was just something to try for me, because I dont know how to accomplish this. I am trying to get the scale of the X and Y values over 10 iterations. This was what I came up with. Any idea how to accomplish this, since this is clearly not the way to go when I read your comment.

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

Well it almost is, you could append the values to an array and always delete the first element, which from a performance standpoint is a nightmare, but it shouldn't be a problem in 2015.

 

Anyways, you don't have to do all that, you can use the DAQmx VI with N Chan N Samples mode and set it to 10 samples. That way you already get the 10 samples you need to put into the linear fit function.

 

Other than that I hope you know that there's a boatload of free tutorials out there, which you can access to get better acquainted with LabVIEW:

3 Hour Introduction
6 Hour Introduction
LabVEW Basics
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Learning NI
Getting Started with NI Products

 

Edit: And from reading your initial post I highly advice you to look at the "state machine" design pattern.



Remember Cunningham's Law
0 Kudos
Message 4 of 4
(2,465 Views)