Getting Started    

Importing Data from the MATLAB Workspace

This section explains how to import data into a model directly from the MATLAB workspace using the Signal From Workspace block, from the DSP Sources library. This is useful for simulating different kinds of signals and noise.

The section explains how to

Simulating a Signal by Importing Data

To import a signal that you create in the workspace, you can use a Signal From Workspace block as a source. An example is the model shown in the following figure. This model is the same as the one shown in the figure Channel Noise Model, except that the Bernoulli Binary Generator block has been replaced with a Signal From Workspace block.

Importing a Signal from the Workspace

To build this model, follow these steps:

  1. Type channeldoc at the MATLAB prompt to open the channel noise model. Then save it under a different name in the directory where you keep your work files.
  2. Replace the Bernoulli Binary Generator block with a Signal From Workspace block from the DSP Sources library.
  3. In the Signal from Workspace block's mask, change the Signal parameter to data (or another variable name).

Before using the model, you must define the vector data in the MATLAB workspace. For example, type data=randint(1,10^4); at the MATLAB prompt. This defines data as a random binary vector of length 104.

Next, select Simulation parameters from the Simulation menu and set the Stop time parameter to length(data). When you run a simulation, the model imports the random vector data into the model.

You can change the vector data in the MATLAB workspace to simulate a less random signal, or import a signal from outside MATLAB.


  Plotting the Results of Multiple Simulations Simulating Noise with Imported Data