02-22-2016 11:14 AM
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
02-23-2016 08:45 AM
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