DSP Blockset    
Signal From Workspace

Import a signal from the MATLAB workspace.

Library

DSP Sources

Description

The Signal From Workspace block imports a signal from the MATLAB workspace into the Simulink model. The Signal parameter specifies the name of a MATLAB workspace variable containing the signal to import, or any valid MATLAB expression defining a matrix or 3-D array.

When the Signal parameter specifies an M-by-N matrix (M1), each of the N columns is treated as a distinct channel. The frame size is specified by the Samples per frame parameter, Mo, and the output is an Mo-by-N matrix containing Mo consecutive samples from each signal channel. The output sample period is specified by the Sample time parameter, Ts, and the output frame period is Mo*Ts. For Mo=1, the output is sample-based; otherwise the output is frame-based. For convenience, an imported row vector (M=1) is treated as a single channel, so the output dimension is Mo-by-1.

When the Signal parameter specifies an M-by-N-by-P array, each of the P pages (an M-by-N matrix) is output in sequence with period Ts. The Samples per frame parameter must be set to 1, and the output is always sample-based.

Initial and Final Conditions

Unlike the Simulink From Workspace block, the Signal From Workspace block holds the output value constant between successive output frames (i.e., no linear interpolation takes place). Additionally, the initial signal values are always produced immediately at t=0.

When the block has output all of the available signal samples, it can start again at the beginning of the signal, or simply repeat the final value or generate zeros until the end of the simulation. (The block does not extrapolate the imported signal beyond the last sample.) The Form output after final data value by parameter controls this behavior:

Examples

Example 1

In the first model below, the Signal From Workspace imports a two-channel signal from the workspace matrix A. The Sample time is set to 1 and the Samples per frame is set to 4, so the output is frame-based with a frame size of 4 and a frame period of 4 seconds. The Form output after final data value by parameter specifies Setting To Zero, so all outputs after the third frame (at t=8) are zero.

Example 2

In the second model below, the Signal From Workspace block imports a sample-based matrix signal from the 3-D workspace array A. Again, the Form output after final data value by parameter specifies Setting To Zero, so all outputs after the third (at t=2) are zero.

The Samples per frame parameter is set to 1 for 3-D input.

Dialog Box

Signal
The name of the MATLAB workspace variable from which to import the signal, or a valid MATLAB expression specifying the signal.
Sample time
The sample period, Ts, of the output. The output frame period is Mo*Ts.
Samples per frame
The number of samples, Mo, to buffer into each output frame. This value must be 1 if a 3-D array is specified in the Signal parameter.
Form output after final data value by
Specifies the output after all of the specified signal samples have been generated. The block can output zeros for the duration of the simulation (Setting to zero), repeat the final data sample (Holding Final Value) or repeat the entire signal from the beginning (Cyclic Repetition). Tunable.

Supported Data Types

To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.

See Also

From Wave Device
DSP Blockset
From Wave File
DSP Blockset
Signal From Workspace
DSP Blockset
To Workspace
Simulink
Triggered Signal From Workspace
DSP Blockset

See the sections below for related information:


  Short-Time FFT Signal To Workspace