[x,t] = simplenarx_dataset;
xnew = x(81:100);
x = x(1:80);
t = t(1:80);
net = narxnet(1:2,1:2,20);
[Xs,Xi,Ai,Ts] = preparets(net,x,{},t);
net = train(net,Xs,Ts,Xi,Ai);
[Y,Xf,Af] = net(Xs,Xi,Ai);
[netc,Xic,Aic] = closeloop(net,Xf,Af);
y2 = netc(xnew,Xic,Aic)
[sysName,netName] = gensim(netc,'InputMode','Workspace',...
'OutputMode','WorkSpace','SolverMode','Discrete');
setsiminit(sysName,netName,netc,Xic,Aic,1);
x1 = nndata2sim(x,1,1);
Best Answer