%% Model of Lowpass Butterworth Filter
% Create a lowpass Butterworth filter and realize its Simulink(R) model
% with coefficients mapped to ports. Call the filter |NewFilter|.

%%

[b,a] = butter(4,.25);
d = dfilt.df1(b,a);
realizemdl(d,'MapCoeffsToPorts','on','BlockName','NewFilter')

%%
% In this case, the filter is an IIR filter with a direct form II
% second-order sections structure. Setting |MapCoeffstoPorts| to |'on'|
% exports the numerator coefficients, the denominator coefficients, and the
% gains to the MATLAB(R) workspace using the default variable names |Num|,
% |Den|, and |g|. Each column of |Num| and |Den| represents one
% second-order section. You can modify the filter coefficients directly in
% the MATLAB workspace providing tunability to the realized Simulink model.

%% 
% Copyright 2012 The MathWorks, Inc.