In order to use fdesign.comb you have to do something like the following to specify the parameters of the filter
D = fdesign.comb('notch','N,BW',8,.01);
but then you must generate the filter as you mentioned in your question.
H = design(D); % H is a DFILT
you can then view the filter like this
fvtool(H)
One way to apply the filter to your data is to use the filter function
y=filter(H.Numerator,H.Denominator,inArray)
My favorite way to design a filter I've never used is with fdatool because you can play around with all of your parameters. Here is how I would do it:
- Type fdatool at the command prompt and a window pops up
- Specify Notching in the dropdown that initially says Differentiator
- Inder IIR choose comb
- Input your parameters
- click Design Filter
Once you play around and it looks as you wish, you can either export the coefficients or generate the code that would create this filter.
To export coefficients
- go to file and click export
- make note of the variable names and click export
- now you can use the filter command with
y = filter(num,den,data);
To generate code
- go to file and click generate MATLAB code
- save the file
You see in this file something like the following
Fs = 48000; % Sampling Frequency
N = 10; % Order
BW = 1200; % Bandwidth
Apass = 1; % Bandwidth Attenuation
[b, a] = iircomb(N, BW/(Fs/2), Apass);
Hd = dfilt.df2(b, a);
the line with iircomb is what generates the filter coefficients, you can now use y=filter(b,a,data);
Hope this helps.