Clear Filters
Clear Filters

Why am I getting an incorrect filtered signal with the dsp.FIRFilter system object?

1 view (last 30 days)
Given the following code:
fd = 1/3;
x = [1 zeros(1,1023)]';
[h,i0,bw] = designFracDelayFIR(fd);
fdf = dsp.FIRFilter(h);
y_actual = fdf(x);
y_expected = filter(h,1,x);
Plotting the filtered signals generated by the "filter" function and "dsp.FIRFilter" object (in the DSP System Toolbox) in MATLAB R2021b result in the plot below:
The top plot in the figure represents the filtered signal, ("y_actual") and the bottom plot in the figure represents the filtered signal, ("y_expected"). The bottom figure is what I expect to see, why is the top figure (using the "dsp.FIRFilter" object) incorrect?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 15 Sep 2022
To obtain the same output with the "dsp.FIRFilter" object and "filter" function, the input needs to be provided as a column vector:
>> x = [1 ones(1,1023)]';
With system objects and blocks in DSP System Toolbox, each column of input is considered to be a separate channel. If the input is provided as a row vector, the "dsp.FIRFilter" object considers it to be an input of frame size 1 and number of channels as 1024 and processes each channel separately which is why you previously get an output vector with all values as the same.
For more details, you can refer to https://www.mathworks.com/help/dsp/index.html?s_tid=hc_product_card

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!