Compare Speed Performance in Frame-Based Processing Mode Using Simulink Profiler
You can filter a noisy sinusoidal signal using a Biquad Filter block. The Biquad Filter block operates in the frame-based processing mode. You can change the input frame size and compare the simulation speed using Simulink Profiler (Simulink).
Open the Model
filterUsingBiquad.slx model by clicking the Open Model button on the example.
The input signal in the model is the sum of two sine waves with frequencies of 1 kHz and 10 kHz and white Gaussian noise with zero mean and a variance of 0.05. The sample rate of the signal is 44.1 kHz.
The Input processing parameter in the Biquad Filter block is set to
Columns as channels(frame based). The block is configured to operate in the frame-based processing mode, and therefore processes signals one frame at a time. In this case, the input signal has 256 samples per frame.
Run the Model with Simulink Profiler
Run the model with the Profiler to generate a profiler report that contains the performance results. Before profiling the model, replace the Spectrum Analyzer with output ports so that the scope does not affect the overall speed performance.
To open the Simulink profiler, on the Debug tab, under Performance Advisor, click Simulink Profiler. On the Profiler tab, click Profile. When simulation is complete, the Profiler Report pane opens and displays the simulation profile for the model. Note the Total Time (s) value and the Number of Calls made by the Simulink scheduler.
Increase Frame Size and Compare Simulation Performance
Now increase the signal frame size by setting the Samples per frame parameter in the source blocks to 1024.
Rerun the Simulink profiler. To compare the performance side-by-side, open another report panel. On the Profiler tab, click Add Report Panel. A new report panel window opens. Click Profile to rerun the Simulink profiler. In the Run dropdown, you can select the simulation reports to compare.
When you increase the frame size, the Total time (s) and the Number of Calls metrics improved significantly. This is because simulating with a larger frame size requires fewer block calls and fewer calls to the Simulink scheduler.
Biquad Filter | Sine Wave | Random Source | Spectrum Analyzer