06-15-2016 12:02 AM
Here's what I want to do.
I am acquiring a signal from potentiometer via DAQ card.
However that FFT of that signal reveals unexpected peaks that cant be explained.
It appears that it is picking up some random values.
What I propose to do :
the unexpected peak occurs at 350 Hz.
I will avearge the samples. as in i choose my sampling frequency as 700Hz. then take which means i take 700 samples in a second.
However, i take 7000 samples in a second, average out every 10 samples so that i am left with effective rate of 700 Hz.
How can i do that?
Kindly help
.
Very urgent
06-15-2016 12:42 AM
Hi Bgmnt,
use a loop to average each 10 samples into an average value:
FOR i:=0 to arraysize/10 ArraySubset(start:=i*10, size:=10) mean(arraysubset) NEXT
How do you want to detect peaks at 350Hz when you sample with just 700Hz?
06-15-2016 12:51 AM
There are many ways to do this. Attached is a very basic and of course poor way of doing it! If you feed an aray of 7000 elements into this VI, it will return an array of 700 elements which are average of sets of 10 elements from the input array. However, please note that:
1- This VI is not flexible; what if you want to sample every 5 elements?
2- This VI will waste memory since it keeps resizing two arrays.
A better more advanced solution would be able to resolve both these problems, but I'm not sure if you are an advanced enough user to go there. I'd recomment using this as a starting point and if you run into memory issues or decided to grow your application, we can work on better solutions.
06-15-2016 12:55 AM
I am using Lab VIEW 10, could you send it in my version ?
06-15-2016 01:00 AM
No problem, I saved another version for LabVIEW 10.
06-15-2016 01:06 AM
i am also facing another problem , while storing my dynamic data to array it shows and error that data types dont match.
it says that sink is double precision and input is array. how do i change that?
06-15-2016 01:15 AM
It looks like you are trying to feed a numeric data (single measurement) into this VI. But this VI accepts an array of numeric values to post-process your raw data. You need to create an array from the acquired values and feed that array into this VI. You'll be able to figure that part out if you take LabVIEW Core 1. It will teach you how to do simple array operations and you can apply it to your application. You can visit www.ni.com/self-paced-training for LabVIEW Core 1.
06-15-2016 05:30 AM - edited 06-15-2016 05:32 AM
Just helping to diagnose your data error here. You are sampling at 700Hz. Therefore 350Hz is your maximum frequency you can read (well, actually not quite 350Hz). So my guess is that you have some aliasing happening (higher frequencies show up as lower frequencies). I would try changing your sampling rate to something more like 1 or 2 kHz. If you still have unexpected noise at 350Hz, then the noise is real.
As far as the averaging, just read 10 samples and use Mean.vi to do the average.
06-16-2016 03:32 AM
@DTV_AVE
The actual sampling frequency of the acquired signal is 2kHz . Even the the poteiometer signal shows a peak at around 200Hz. But what i fail to understand is that why this frequency is obbserved even though THERE IS NO MOVEMENT IN THE POTENTIOMETER. It is still and rests at a support.
Then why is this frequency coming?
06-16-2016 04:18 AM
I guess, this last message was meant for Crossrulz. What I can add to Cross' comment is that you need to make sure your sampling rate is higher than the highest frequency component of your signal multiplied by 2 (Nyquist Theorem). Otherwise you will run into aliasing issues. One solution could be filtering your input data to prevent higher frequencies from getting in and causing aliasing. For example, if you want to sample at 1 KHz, having a 500Hz (preferably lower) LPF can prevent aliasing.