Cascade of discrete filters in MATLAB
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello everyone. I'm trying to make a band-reject filter but I can't put 2 filters in cascade.
This:
lp = fir1(100, 0.77, 'low', rectwin(101));
hp = fir1(100, 0.83, 'high', rectwin(101));
dfilt.cascade(lp,hp)
gives the following error: Error using dfilt.cascade (line 43) Numeric section in a cascade must be a nonempty scalar.
Thanks!
댓글 수: 0
채택된 답변
Star Strider
2016년 5월 8일
To use dfilt.cascade, you have to create the correct dfilt filter objects from your filters first:
lp = fir1(100, 0.77, 'low', rectwin(101));
hp = fir1(100, 0.83, 'high', rectwin(101));
lpf = dfilt.df2(lp,1);
hpf = dfilt.df2(hp,1);
ntch = dfilt.cascade(lpf,hpf);
figure(1)
freqz(ntch)
You may want to reconsider your filter designs.
댓글 수: 2
Star Strider
2016년 5월 8일
You are not calling filter correctly.
Try this:
filtered_audio = filter(sb,mono);
추가 답변 (1개)
CS Researcher
2016년 5월 8일
You would have to convert the filters to dfilt type. Try this:
lp = fir1(100, 0.77, 'low', rectwin(101));
hp = fir1(100, 0.83, 'high', rectwin(101));
h1 = dfilt.df2t(lp,1);
h2 = dfilt.df2t(hp,1);
h = dfilt.cascade(h1,h2);
However, Mathworks documentation states:
"Note that with the DSP System Toolbox installed, one usually does not construct cascade filters explicitly. Instead, one obtains these filters as a result from a design using FDESIGN." You should look into this.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate and Multistage Filters에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!