Filter cascade with raised cosine filter and half-band filter
2 views (last 30 days)
Show older comments
I've created a raised cosine filter and a half-band filter, respectively, and want to cascade them. However, I got "Numeric stages of size [1 11] are not supported. All numeric stages must be scalars."
Fs = 20e3;
Fp = 15e3;
rc = rcosdesign(0.35, 5, 2, 'sqrt');
Fs2 = 4*Fs; % Sample rate
Fp2 = Fp; % Passband edge
Fh2 = Fs2/4; % Halfband frequency
TW2 = (Fh2-Fp2)/Fh2;
N2 = 48;
hb2 = designHalfbandFIR(FilterOrder=N2,...
TransitionWidth=TW2,...
Passband='lowpass',...
DesignMethod='kaiser',...
Structure='interp',...
SystemObject=true);
Fc = cascade(rc, hb2);
I also created the raised cosine filter with comm.RaisedCosineTransmitFilter to see if this works. However, MATLAB returned another error, "Cascades must be made of discrete-time filter (DFILT) objects.".
Fs = 20e3;
Fp = 15e3;
rc = comm.RaisedCosineTransmitFilter;
Fs2 = 4*Fs; % Sample rate
Fp2 = Fp; % Passband edge
Fh2 = Fs2/4; % Halfband frequency
TW2 = (Fh2-Fp2)/Fh2;
N2 = 48;
hb2 = designHalfbandFIR(FilterOrder=N2,...
TransitionWidth=TW2,...
Passband='lowpass',...
DesignMethod='kaiser',...
Structure='interp',...
SystemObject=true);
Fc = cascade(rc, hb2);
Why two codes show different errors and what am I supposed to cascade two filters?
0 Comments
Accepted Answer
Paul
on 28 Mar 2025
Fs = 20e3;
Fp = 15e3;
rc = rcosdesign(0.35, 5, 2, 'sqrt');
Fs2 = 4*Fs; % Sample rate
Fp2 = Fp; % Passband edge
Fh2 = Fs2/4; % Halfband frequency
TW2 = (Fh2-Fp2)/Fh2;
N2 = 48;
hb2 = designHalfbandFIR(FilterOrder=N2,...
TransitionWidth=TW2,...
Passband='lowpass',...
DesignMethod='kaiser',...
Structure='interp',...
SystemObject=true);
whos rc hb2
rc = dsp.FIRFilter(rc);
Fc = cascade(rc, hb2);
I'm not familiar with the DSP Toolbox. Why does hb2 have a sample rate (and where did it come from as it's not specified in the call to designHalfBandFIR?)
hb2.SampleRate
but rc does not have a sample rate?
rc.SampleRate
Regardless, I hope this at least points you in the right direction.
More Answers (0)
See Also
Categories
Find more on Filter Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!