Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 69272

filtfilt() filter in matlab and labview

$
0
0

I want to apply a low pass butterworth filter in labview based on matlab code i already have.But it seems to be more difficult then it should.This is the code I have in matlab:

 

----------------------

Wn=low_cutoff*2/20;

[fb fa]=butter(2,Wn,'low');

Data_LPF = filtfilt(fb,fa,intensity);

-----------------------

 

where low_cutoff and intensity are inputs.

 

I want to do the same in labview.

Option 1 is to Use a mathscript node and copy the exact code above and get the same results.

 

This is good, except the problem is right now I am testing both matlab and labview codes with a data file.

so I can adjust the number of data points being read in.

Since the filtfilt() in matlab needs a minimum input length of 3*filter order, I will need to pass it in at least 6 data points(filter order is 2). Right now I can control this, but ultimatley data will be coming in at various lengths, so it will not always be 6, and I get an error.

 

So my question is how can I do this using the labview vis, because I know they dont have a limit like this  on the input length?

 

I tried using Butterworth coefficients.vi, followed by IRR Filter.vi, but the results are not the same.

even the forward and reverse coefficients(fa and fb) are not the same.

 

Im not too good with all these filters so if someone could please help!!:smileyhappy:

 

And I what the filter to be applied continuously, to all data coming in. That's why I set the init/cont value to TRUE.

 

 

In the attached vi, each case shows the various ways I have tried so far but still no luck : (

 

 

I tried reading this:

http://forums.ni.com/t5/Signal-Conditioning/IIR-Filter-Someone-please-help-me/td-p/2427108

 

 

but what they recommend doesnt seem to work for me...


Viewing all articles
Browse latest Browse all 69272

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>