Documentation

ExternalInput

Set external inputs for a simulation through SimulationInput object, in

Syntax

in.ExternalInput = [t, u1,..uN]
in.ExternalInput = ds
in.ExternalInput = ts

Description

example

in.ExternalInput = [t, u1,..uN] allows you to directly specify numerical arrays as inputs to a model if a model has root inports.

in.ExternalInput = ds allows you to directly specify dataset objects as external inputs to a model if a model has root inports..

in.ExternalInput = ts allows you to directly specify timeseries object as external input if a model has a single root inport.

Examples

collapse all

This example shows how to set numerical arrays as external inputs.

Open the model

open_system('sldemo_mdlref_counter');

Create a SimulationInput object for this model.

in = Simulink.SimulationInput('sldemo_mdlref_counter');

Prepare external inputs.

t = (0:0.01:10)';
u1 = 5*ones(size(t));
u2 = 10*sin(t);
u3 = -5*ones(size(t));

Set external inputs to the model.

in.ExternalInput = [t, u1, u2, u3];

Simulate the model.

out = sim(in);

Input Arguments

collapse all

Numerical array to be used as an external input.

Dataset object to be used as an external input

Time series to be used as an external input

Introduced in R2017a

Was this topic helpful?