Why am I getting an incorrect filtered signal with the dsp.FIRFilter system object?
6 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2022-9-15
回答: MathWorks Support Team
2022-9-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
2022-9-15
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Single-Rate Filters 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!