Main Content

setsiminit

Set neural network Simulink block initial conditions

Syntax

setsiminit(sysName,netName,net,xi,ai,Q)

Description

setsiminit(sysName,netName,net,xi,ai,Q) takes these arguments,

sysName

The name of the Simulink® system containing the neural network block

netName

The name of the Simulink neural network block

net

The original neural network

xi

Initial input delay states

ai

Initial layer delay states

Q

Sample number (default is 1)

and sets the Simulink neural network blocks initial conditions as specified.

Examples

Here a NARX network is designed. The NARX network has a standard input and an open loop feedback output to an associated feedback input.

[x,t] = simplenarx_dataset;
     net = narxnet(1:2,1:2,20);
     view(net)
     [xs,xi,ai,ts] = preparets(net,x,{},t);
     net = train(net,xs,ts,xi,ai);
     y = net(xs,xi,ai);

Now the network is converted to closed loop, and the data is reformatted to simulate the network’s closed loop response.

net = closeloop(net);
view(net)
[xs,xi,ai,ts] = preparets(net,x,{},t);
y = net(xs,xi,ai);

Here the network is converted to a Simulink system with workspace input and output ports. Its delay states are initialized, inputs X1 defined in the workspace, and it is ready to be simulated in Simulink.

[sysName,netName] = gensim(net,'InputMode','Workspace',...
	'OutputMode','WorkSpace','SolverMode','Discrete');
setsiminit(sysName,netName,net,xi,ai,1);
x1 = nndata2sim(x,1,1);

Finally the initial input and layer delays are obtained from the Simulink model. (They will be identical to the values set with setsiminit.)

[xi,ai] = getsiminit(sysName,netName,net);

Version History

Introduced in R2010b