%% Realize Simulink Model of a Lowpass Butterworth Filter
%%
d = fdesign.lowpass('N,F3dB',4,0.25);
filterobject = design(d,'butter','systemobject',true);
%%
% Create a new model, |LPFilter.slx|, and realize the subsystem block in
% this model.
new_system('LPFilter');
realizemdl(filterobject);
%%
% View the block diagram by clicking on the subsystem block.
%
% <<../blockdiagram.png>>
%
%%
% Create a new model, |LPFilterMapping.slx|, and realize the subsystem 
% block, with coefficients mapped to ports, in this model. 
new_system('LPFilterMapping');
realizemdl(filterobject,'MapCoeffsToPorts','on');
%%
% View the block diagram by clicking on the subsystem block.
%
% <<../mapcoefftoports.png>>
%
%%
% 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.