Note: Starting in R2010b, many DSP System Toolbox™ blocks received a new parameter to control whether they perform sample- or frame-based processing. The following content has not been updated to reflect this change. For more information, see the Frame-Based Processing section of the Release Notes.
|On this page…|
A frame-based signal is propagated through a model in batches of samples called frames. Frame-based processing can significantly improve the performance of your model by decreasing the amount of time it takes your simulation to run.
One of the most commonly used blocks in the Sources library is the Sine Wave block. This topic describes how to create a three-channel frame-based signal using the Sine Wave block:
Amplitude = [1 3 2]
Frequency = [100 250 500]
Sample time = 1/5000
Samples per frame = 64
Based on these parameters, the Sine Wave block outputs three sinusoids with amplitudes 1, 3, and 2 and frequencies 100, 250, and 500 hertz, respectively. The sample period, 1/5000, is 10 times the highest sinusoid frequency, which satisfies the Nyquist criterion. The frame size is 64 for all sinusoids, and, therefore, the output has 64 rows.
You have now successfully created a three-channel frame-based signal using the Sine Wave block. The rest of this procedure describes how to add these three sinusoids together.
The three signals are summed point-by-point by a Matrix Sum block. Then, they are exported to the MATLAB workspace.
Your plot should look similar to the following figure.
This figure represents a portion of the sum of the three sinusoids. You have now added the channels of a three-channel frame-based signal together and displayed the results in a figure window.
A frame-based signal is propagated through a model in batches of samples called frames. Frame-based processing can significantly improve the performance of your model by decreasing the amount of time it takes your simulation to run. This topic describes how to create a two-channel frame-based signal with a sample period of 1 second, a frame period of 4 seconds, and a frame size of 4 samples using the Signal From Workspace block:
Signal = [1:10; 1 1 0 0 1 1 0 0 1 1]'
Sample time = 1
Samples per frame = 4
Form output after final data value by = Setting to zero
Based on these parameters, the Signal From Workspace block outputs a two-channel, frame-based signal has a sample period of 1 second, a frame period of 4 seconds, and a frame size of four samples. After the block outputs the signal, all subsequent outputs have a value of zero. The two channels contain the following values:
Channel 1: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 0,...
Channel 2: 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0,...
The following is the output displayed at the MATLAB command line.
yout = 1 1 2 1 3 0 4 0 5 1 6 1 7 0 8 0 9 1 10 1 0 0 0 0
Note that zeros were appended to the end of each channel. You have now successfully created a two-channel frame-based signal and exported it to the MATLAB workspace.