getsiminit

Get Simulink neural network block initial input and layer delays states

Syntax

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

Description

[xi,ai] = getsiminit(sysName,netName,net) 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

and returns,

xi

Initial input delay states

ai

Initial layer delay states

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);
Was this topic helpful?