01-26-2011 05:35 PM
Hi
I am pretty new to CVI. I've only used it for a course in university.
I'm wondering if CVI can do things that Matlab can do. For example, a notch filter is very easily implemented in Matlab.
Is there a way to create a notch filter in CVI?
Thanks,
Jasmine
01-27-2011 10:25 AM
Hi Jasmine,
In the CVI Library you should find a Advanced Analysis Library. From there go to Signal Processing»FIR Digital Filters and look for any function that ends in _BSF (Band Stop Filter). These functions will give you the coefficients for a filter and then you would convolve it with your signal to filter the signal. Here's some example code that comes with the Wind_BSF filter:
/* Design a 55-point bandstop FIR
linear phase filter that can achieve at least a 44 dB attenuation and filter the
incoming signal with the designed filter. */
double x[256], coef[55], y[310],
fs, fl, fh;
n, m, windType;
fs = 1000.0; /* sampling frequency */
fl =
200.0; /* desired lower cutoff frequency */
fh = 300.0; /* desired higher
cutoff frequency */
/* stop band is from 200.0 to 300.0 */
n = 55; /*
filter length */
windType = 3; /* using Hanning window */
m =
256;
Wind_BSF (fs, fl, fh, n, coef, windType);
Convolve (coef, n, x, m,
y); /* Convolve the filter with the signal. */
I hope this helps!