%% Tune Center Frequency Using Input Port
% Tune the center frequency of an Octave Filter block in Simulink(R) using
% the optional input port.
%
open_system('OctaveInputPort')

%% 
% 1. Run the simulation. The From Multimedia File block sends a stereo
% audio stream to the Octave Filter block. The center frequency of the
% Octave Filter block can be tuned using the manual switches routed into
% the optional input port. The filtered audio is sent to your computer's
% default audio device. The filtered audio and unfiltered audio are sent to
% a Spectrum Analyzer block for visualization.
% 
% 2. Tune the center frequency by toggling manual switches routing constant
% values. The constant value routed from the left is multiplied with the
% constant value routed from the right. The center frequency of the Octave
% Filter block can be set at 400, 800, 4000, and 8000 Hz.
%
% 3. Observe the Spectrum Analyzer as you tune the center frequency. Note
% how the center frequency changes as you toggle the manual switches.
sim('OctaveInputPort', 5)
%%
open_system('OctaveInputPort/Spectrum Analyzer')
save_system('OctaveInputPort')
close_system('OctaveInputPort')

%% 
% Copyright 2018 The MathWorks, Inc.