Why do I get error when designing a multistage filter with specified number of stages in Filter Design Toolbox 4.5 (R2009a)?

1 view (last 30 days)
I am trying to design a filter as below:
Fpass = 0.4; % Passband Frequency
Fstop = 0.5; % Stopband Frequency
Apass = 1; % does not work
% Apass = 2 ; % works
Astop = 100; % Stopband Attenuation (dB)
Fs = 48; % Sampling Frequency
h = fdesign.decimator(48, 'Lowpass', 'fp,fst,ap,ast', Fpass, Fstop, Apass, Astop, Fs);
Hd = design(h, 'multistage', ...
'FilterStructure', 'firdecim', ...
'UseHalfbands', true, ...
'NStages',5);
With Apass = 1, the code throws the following error:
??? Output argument "varargout" (and maybe others) not assigned during call to
"C:\Program
Files\MATLAB\R2009a\toolbox\signal\signal\@fdesign\@abstracttype\multistage.m>multistage".
Error in ==> fdesign.decimator.multistage at 21
Hm = multistage(this.CurrentFDesign, varargin{:}, 'rcf', -dfactor,...
Error in ==> fdesign.abstracttype.design at 109
Hd = feval(method, this, varargin{:});
With Apass = 2 the code works fine.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 19 Jan 2010
This is a limitation in the optimization algorithm used in Filter Design Toolbox when designing multi-stage filters.
The limitation is that the 'NStages' design option cannot be greater than the optimum number of stages found by the design algorithm.
Our code searches for the set of P optimum factors that will yield the requested decimation factor of 48 with P stages. The optimization is based on reducing the overall cost of the filter.
In the example where Ap = 1, the algorithm found that the best way to factorize 48 is by first dividing by 3, then by 4, then by 2, and then by 2 again which yields a number of stages equal to 4.
When Ap = 2, the algorithm found that the best way to factorize 48 was by dividing by 3, then by 2, then by 2, then by 2, and then by 2 again which yields a number of stages equal to 5.

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2009a

Community Treasure Hunt

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

Start Hunting!