Thursday 13 November 2014

How to design a simple low pass filter (LPF) in Matlab?

%% LPF filter specifications

fSamp = 45e6;

Fpass = 1.25e6/(fSamp/2);          % Passband Frequency
Fstop = 2.5e6/(fSamp/2);        % Stopband Frequency
Apass = 1;           % Passband Ripple (dB)
Astop = 80;          % Stopband Attenuation (dB)
match = 'passband';  % Band to match exactly

% Construct an FDESIGN object and call its BUTTER method.
%d  = fdesign.lowpass(Fpass, Fstop, Apass, Astop, fSamp);
d=fdesign.lowpass('Fp,Fst,Ap,Ast',Fpass,Fstop,Apass,Astop);
designmethods(d)
Hd = design(d,'equiripple');
fvtool(Hd); %shows the response

%Using filter

inpSignalFiltered = filter(Hd, inpSignal);




No comments:

Post a Comment