Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with applying Butterworth Filter

I am having difficulties coding a Butterworth filter.  I need to acquire the data from an NI analog input, apply the filter and then continuous plot to the Waveform graph.  I have looked at the white paper but am still struggling to get the coding correct.  Can someone please help?  Here is what I have so far.  I need to apply the filter before I execute the append but I don't how to apply it.  I'm getting errors.  I can append the data continuously to the Waveformgraph fine so I know I'm good up to this point.  

 

'Create aquiring task with channels.  Channels configurued in another sub
Dim data() As AnalogWaveform(Of Double) Dim i As Integer = 0 Dim myTask As New NationalInstruments.DAQmx.Task("myTask1") reader = New AnalogMultiChannelReader(myTask.Stream)
'Create Filter and set filter parameters
Dim newFilter As New ButterworthLowpassFilter(filterOrder, samplingFrequency, cutoffFrequency) Dim samplingFrequency As Integer = 1000 Dim filterOrder As Integer = 4 Dim cutoffFrequency As Double = 3.0 'This block of code appends raw data to the WFG, currently no filtering applied Try data = reader.ReadWaveform(samplingFrequency) i = 0 For Each WaveformGraph In WFGS 'Collection of WaveformGraph objects WaveformGraph.PlotWaveformAppend(data(i)) i = i + 1 Next Catch End Try
0 Kudos
Message 1 of 2
(3,681 Views)

Hi busarider29,

 

We have a shipping example that is installed here: C:\Users\Public\Documents\National Instruments\MStudioVS2013\DotNET\Examples\Analysis\Professional\Filtering\cs

 

It shows how to use filters.

 

G-IV

0 Kudos
Message 2 of 2
(3,666 Views)