04-10-2009 04:22 PM
I am trying to integrate a signal using labview, and it does not do what I want it to do. I find the peak, then use the location of the peak to find t1 and t2, then integrate over that interval. It integrates when I do not add my desired equation, but when I do it always outputs zero. Attatched is my VI, below is my desired integral equation.
[1/(t2-t1)*integrated signal]^(2.5)*(t2-t1)
04-13-2009 04:57 PM
Howdy jjacobs,
I took a look at your code and since I don't have your equipment, I couldn't replicated the functionality. However, I'm curious how the code does not perform as you'd like it to. Here are some questions to help narrow this down:
Also, I'm not quite sure of what you mean when you say "It integrates when I do not add my desired equation, but when I do it always outputs zero." An example of using the integration VI can be found in the Program Files\labview\examples\analysis\statxmpl.llb folder. Thanks, I look forward to hearing back from you!
04-15-2009 03:52 PM
Hi Chris,
1.The VI does acquire data the right way.
2. The peak detection works erratically. When the peaks are sufficiently larger than my threshold, it starts to integrate. If it were a small peak, it would pass through my vi without being detected
3. I have used a sinusoid wave to test my integral, and it reutrned zero, which is what I expected. Based on this, I believe it is working correctly.
4. I have tried mathscript, but not integrating within mathscript. What I have been doing is integrating the signal with integral x(t), then passing it to mathscript. The output of that mathscript with this equation :
I=(A^2.5);
where A is the input, and I is the output. This always gives me zero. That is what I meant by the desired equation thing.
Thanks!
04-16-2009 12:06 PM - edited 04-16-2009 12:12 PM
Hey JJ,
Thanks for the response! From your answers, it seems your problem is in the MathScript node since your signal is integrating properly. Have you considered replacing the node with the Power of X VI located in the Mathematics » Elementary and Special Functions » Exponential Functions palette? This will allow you to feed your integrated array directly into the VI and raise each element to a power of 2.5. It seems like this is what you are trying to do with the MathScript node from looking at your code. Please post back with the results. Thanks!
03-04-2015 01:40 PM
Hello Guys,
I'm simply trying to integrate peaks. I opened the Quadrature Integrand.vi with your instructions. The first VI is labeled "data" in the block diagram. How do you connect data from an X, Y graph to this VI? I tried using an example block diagram where I was able to get a signal but the wire connecting did not talk to "data" VI (.NET Refnum issue). My end goal is to be able to integrate the area of a peak- X axis time Y-axis amplitude. Thank you for all your help.
Blessings,
Phil
03-04-2015 04:49 PM
You could always use the Trapezoid Rule to approximate the integral. I assume you have an array of data, you know where the peak is, and you know the lower and upper limits (of X) over which you want to integrate. Now all you need is the sampling interval, dt ("delta-t"). Simply add the Y values from the lower to the upper limit, multiply by dt, and there's your integral! Note that LabVIEW can return you an array subset (one function), can sum the (sub-)array (one function), and can divide by dt, so with three LabVIEW functions, the Y values, the lower and upper limit, and dt, you have your integral.
BS
03-04-2015 05:06 PM
Hello Bob,
Thank you for the information about integration! I was looking to see if there was a to select a peak for automatic integration, but it looks as though using these 3 functions may be the way to go. I'm actually still trying to output an X, Y graph from the LabView 2014 example-"ULx Cont Acq&Chart Samples-SW Timed.vi". Wire connections are fine, just not getting a signal. It allows me to output the signal as Wavegraph but having difficulty displaying the changes in the analog signal with the X, Y graph which I assumed was needed to have an accurate baseline for integration (may be wrong). Is it even possible to output an X, Y graph using this example?
03-04-2015 10:04 PM
03-05-2015 08:53 AM
Thank you Dennis! That was quite helpful and so is this youtube for constructing "while" and "for" loops. https://www.youtube.com/watch?v=GBhJk5Tnshc
I'll post later when I have played around with these suggestions.
Blessings,
Phil