03-01-2019 10:45 AM
Hello guys, I'm doing a program (for my research activity) which it's supposed to calculate the distance between two peaks of a signal (in order to find the period) while the window is scrolling. I'm new to labview actually and I read all the previous discussions of this topic but I can't seem to find a solution. Here I am attaching the vis so can you please help?
Thank you in advance.
03-01-2019 12:49 PM
Hi Deuchi,
I assume this code is not working how you want, but can you explain what you expect and what you observe? I see you calculating a difference in peak location outside of the while loop, so this will only run once when your program stops. If you want this to run as you acquire your signal you need to put it inside your loop.
03-01-2019 01:02 PM
I expect the time difference between two peaks, I acquired a sinus signal of 1hz so I expect the distance between the peaks to be 1, and to stay like that. I tried to put it inside the loop but the difference keeps changing and I don't know why...
I put the second one outside the loop because I thought I could get a difference between peaks once the cycle stopped. But I keep getting strange values like very very small numbers.
03-01-2019 03:55 PM
Can you save the VI with data in the indicators so we can see your data? Once you collect the data, you can either copy the indicator, then make it a constant, or set the value as default.
03-04-2019 03:30 AM
I'm attaching the VI along with the datas I screenshoted. I think it works the way I did the code. The only problem I am having are the peaks because it seems my VI is taking a lot of peaks for a period, and I just want one, and in the second graph they don't seem to appair at all.
03-04-2019 04:10 AM - edited 03-04-2019 04:11 AM
Hi deuchi,
you failed in including data in your graphs, so we cannot try to analyze your data…
3 simple steps:
Run your VI to show some data in the graphs, then stop it.
Edit menu -> make current values default
Save the VI and attach it here!
(I also prefer a 4th step: use AutoCleanup before saving!)
03-04-2019 04:21 AM
Ah sorry, I'm new to labview so I didn't know what to do. I did what you told me so I will attach the VI here. Thank you.
03-04-2019 04:32 AM - edited 03-04-2019 04:35 AM
03-04-2019 05:05 AM
Sorry again.. I hope it works this time. I still don't know how to do the AutoCleanup though.
I attached the width in the peak detector.
Thank you for your patience!
03-04-2019 05:10 AM
My problem is that I get a lot of values (the time positions) for the same peak, and another problem is that it doesn't show all the values of other peaks in other time.
I want to build an array to store all the positions in time, in order to make the difference between the first member and the one after.