From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Change the sample rate after filter

Solved!
Go to solution

Hello,

I want to read an accelarometer and then filter the Frequency till 100Hz. After the filtration I want o change the sample rate to 600Hz, so I could save space. How can I change the sample rate after the filtration?

Thanks

0 Kudos
Message 1 of 12
(1,422 Views)
Solution
Accepted by topic author mub.re

Hi mub,

 


@mub.re wrote:

How can I change the sample rate after the filtration?


This is typically called "decimation". Look for related functions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(1,407 Views)
Solution
Accepted by topic author mub.re

Check out the Sample Compression function.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 12
(1,386 Views)

@mub.re wrote:

Hello,

I want to read an accelarometer and then filter the Frequency till 100Hz. After the filtration I want o change the sample rate to 600Hz, so I could save space. How can I change the sample rate after the filtration?

Thanks


This makes no sense.  How are you saving space by resampling at 6 times the filter cutoff frequency?

 

Attach a vi with data and a description of the output.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 12
(1,365 Views)

My initial sample rate is 10k

0 Kudos
Message 5 of 12
(1,347 Views)

@JÞB wrote:

@mub.re wrote:

Hello,

I want to read an accelarometer and then filter the Frequency till 100Hz. After the filtration I want o change the sample rate to 600Hz, so I could save space. How can I change the sample rate after the filtration?

Thanks


This makes no sense.  How are you saving space by resampling at 6 times the filter cutoff frequency?

 


It does make sense, but I had to read it multiple times to realise what they want to do.....

0 Kudos
Message 6 of 12
(1,314 Views)

My understanding is that the OP wants to pass the signal through a low pass filter and retain only signals < 100Hz.

 

Now, the filtered signal can be represented easily with a 600Hz sampling rate since the max signal frequency is only 100Hz.

 

Counter argument, why not sample the Accelerometer at the 600Hz rate and thereby able to sample only up to 300Hz or sample at 200Hz.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 7 of 12
(1,302 Views)

I have been told to use 6x sampling rate

0 Kudos
Message 8 of 12
(1,287 Views)

6x oversampling compared to the highest frequency of interest is fairly minimal for time domain work.  The rule of thumb I've encountered must often is to aim for at least 10x with 20x being preferable.

 

I've been known to run through 3 stages of software filtering:

1. A narrow median filter (left rank=right rank=1 sample) to eliminate "spiky" noise data.  I run this first to suppress such outliers on equipment that needs it.

2. A regular IIR or FIR filter, most commonly Butterworth for its flat and predictable passband gain.  This suppresses higher frequencies that are captured but not of interest.  (Note: it's important to do median filtering *before* IIR or FIR filtering or else the spikes just get partially attenuated and spread out.)

3. Resampling to the desired data logging rate, often using averaging-based decimation.  Averaging helps suppress random noise, and even moreso with larger oversampling factors like 25x.  

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 9 of 12
(1,282 Views)

Hi Kevin,

 

Thank you for your advice. I was confused, which filter to use. Now I know the Butterworth it is. Could please elaborate me the median filtering? I am calculation some low frequency vibration of a moving train, part of my bachelor thesis. My supervisor told me that 6x is enough to collect the vibrations. Everything is new for me. 

 

Thank you in advance.

Regards

Mubin

0 Kudos
Message 10 of 12
(1,275 Views)