Import Data

Create Experiment

Before you begin data import, create an experiment. Simulink® Design Optimization™ software provides a tool for setting up the estimation session.

To create an estimation session:

  1. At the MATLAB® prompt, open the nonlinear idle speed model of an automotive engine by typing :

    engine_idle_speed
    

    The model contains the Inport block BPAV and Outport block Engine Speed for importing input and output data, respectively. To learn more, see Model Requirements for Importing Data.

  2. In the Simulink model window, open the Parameter Estimation tool by selecting Analysis > Parameter Estimation.

    Parameter Estimation Tool

    You can organize the estimation and validation tasks inside Experiments under Data Browser panel on the left. You can assign each experiment to an estimation task or validation task.

    To create an experiment, click the New Experiment button.

    This creates an experiment called Exp under Experiments. To change the name of the experiment, right-click and select Rename. Call it NewData.

      Note:   The Simulink model must remain open to perform parameter estimation tasks.

Time-Domain Data

Experiments are collections of signal data, specifically input and output signal data. After you create an experiment, as described in Create Experiment, you can import data into your experiment from various sources including MATLAB® variables, MAT-files, Excel® files, or comma-separated-value files.

To import data into your experiment right-click and select Edit.... This will launch the experiment editor. In the experiment editor, you can define the signals contained in the experiment.

For example, the rows in the Inputs panel of the editor correspond to Inport block BPAV in the engine_idle_speed model.

The rows in the Outputs panel correspond to Outport block Engine Speed. You can import signal data from files or MATLAB workspace.

    Note:   The Simulink model must contain an Inport or Outport block or logged signals to enable importing data. For more information, see Model Requirements for Importing Data. To select more output signals to specify data for, click Select Measured Output Signals in the Outputs panel.

The idle-speed model of an automotive engine contains the measured data stored in the iodata array in the workspace. The array contains two columns: the first for input data, and the second for output data. The time data is in the time array in the workspace. You can import the input data by typing [time,iodata(:,1)] in the Inputs panel.

You can import the output data by typing [time,iodata(:,2)] in the Outputs panel. You can view the data by clicking . The input data should look like this:

Output data should look like this:

After importing the data for NewData experiment, the experiment editor looks like this:

To import data from a file, click the button.

To learn more about the Edit Experiment: dialog box, see Experiment Editor.

Time-Series Data

Time-series data is stored in time-series objects. For more information, see Time Series Objects in the MATLAB documentation.

When you import input data from a time-series object, t, for parameter estimation, you must specify the time vector and data as [t.time,t.inputdata] in the Inport signal dialog box. Similarly, to import output data, you must specify the time vector and data as [t.time,t.outputdata] in the Outport signal dialog box. For more information on how to import data into the experiment, see Time-Domain Data.

Complex Data

Complex-valued data is data whose value is a complex number. For example, a signal with the value 1+2j is complex. You can use complex data to estimate parameters of electrical systems, such as the magnitude and phase.

    Note:   You must sample the real and imaginary parts of the data as a function of the same time vector.

To use complex data for parameter estimation:

  1. Split the data into two data sets that contain the real and imaginary parts. To split the data, use the MATLAB functions real, and imag.

  2. Create two signals, one for the real part and one for the imaginary part for the Inport or Outport block.

  3. Select both signals in the experiment editor.

  4. Import the data to the corresponding signal as described in Time-Domain Data.

Related Examples

More About

Was this topic helpful?