
Originally Posted by
Samson
Hey Everyone, per Captain Black's Note, I put together the following code but I'm stuck! Please see below!
f_p=40000; %Pass Frequency in Hz
f_s=50000; %Stop Frequency in Hz
r_s=25; %Stopband Attenuation in dB
r_p=3; %Passband Ripple
d = fdesign.bandpass('Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2', 38e3,f_p,f_s,53e3,r_s,r_p,140e3);
%Fst1 — frequency at the edge of the end of the first stop band. Specified in normalized frequency units by default.
%Fp1 — frequency at the edge of the start of the pass band. Specified in normalized frequency units by default.
%Fp2 — frequency at the edge of the end of the pass band. Specified in normalized frequency units by default.
%Fst2 — frequency at the edge of the start of the second stop band. Specified in normalized frequency units by default.
%Ap — passband ripple in dB (the default units).
%Ast1 — attenuation in the first stopband in dB (the default units).
%Ast2 — attenuation in the second stopband in dB (the default units).
% Create the FIR filter
Hd2 = design(d,'equiripple'); fvtool(Hd2)
%Create the IIR filter
Hd1 = design(d,'butter'); fvtool(Hd1);
------------------------------------------------------------------
First off, does my methodology seem correct for creating an FIR and IIR filter that will accomplish this goal? Secondly, when I run the code, this is the error message I get:
??? Error using ==> fdesign.abstracttype.equiripple at 13 Frequency specifications must be between 0 and 1.
Error in ==> fdesign.abstracttype.superdesign at 106 Hd = feval(method, this, varargin{:});
Error in ==> fdesign.abstracttype.design at 11 varargout{1} = superdesign(this, varargin{:});
Error in ==> PEPractice at 13 Hd2 = design(d,'equiripple');
-----------------------------------------------------------------
Any insight as to what is wrong? Please help if you can!