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

1 次查看(过去 30 天)
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?

采纳的回答

MathWorks Support Team
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate and Multistage Filters 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by