%% Lowpass IIR Filter
% Design a lowpass IIR filter with order 8, passband frequency 35 kHz, and passband ripple 0.2 dB. Specify a sample rate of 200 kHz. Visualize the magnitude response of the filter.

lpFilt = designfilt('lowpassiir','FilterOrder',8, ...
         'PassbandFrequency',35e3,'PassbandRipple',0.2, ...
         'SampleRate',200e3);
fvtool(lpFilt)

% Use the filter you designed to filter a 1000-sample random signal.

dataIn = randn(1000,1);
dataOut = filter(lpFilt,dataIn);

%
% Output the filter coefficients, expressed as second-order sections.

sos = lpFilt.Coefficients

% Copyright 2015 The MathWorks, Inc.