Filter cascade with raised cosine filter and half-band filter

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);
Error using dsp.internal.CompositeFilter/checkFilterAndClearMetadata (line 134)
Numeric stages of size [1 11] are not supported. All numeric stages must be scalars.

Error in dsp.FilterCascade/set.Stage1 (line 63)
obj.Stage1 = checkFilterAndClearMetadata(obj, val, obj.Stage1);

Error in dsp.FilterCascade/setStages (line 712)
obj.(stageIdx) = stages{ind};

Error in dsp.FilterCascade (line 153)
obj.setStages(varargin);

Error in dsp.internal.FilterAnalysis/cascade (line 1722)
FC = dsp.FilterCascade(obj,varargin{:});
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?

 Akzeptierte Antwort

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
Name Size Bytes Class Attributes hb2 1x1 8 dsp.FIRHalfbandInterpolator rc 1x11 88 double
rc is a vector of coefficients, but cascade requires its inputs to be filter system objects.
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
ans = 44100
but rc does not have a sample rate?
rc.SampleRate
Unrecognized method, property, or field 'SampleRate' for class 'dsp.FIRFilter'.
Regardless, I hope this at least points you in the right direction.

Weitere Antworten (0)

Produkte

Version

R2024a

Gefragt:

Jay
am 28 Mär. 2025

Kommentiert:

Jay
am 28 Mär. 2025

Community Treasure Hunt

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

Start Hunting!

Translated by