07-01-2015 05:28 AM
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.
07-01-2015 08:45 AM
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.
07-02-2015 01:52 AM
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.
07-02-2015 01:58 AM - edited 07-02-2015 02:02 AM
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.