Add delay to neural network response
net = adddelay(net,n)
net = adddelay(net,n) takes these arguments,
Number of delays
and returns the network with input delay connections increased, and output feedback delays decreased, by the specified number of delays n. The result is a network which behaves identically, except that outputs are produced n timesteps later.
If the number of delays n is not specified, a default of one delay is used.
Here a time delay network is created, trained and simulated in its original form on an input time series X and target series T. It is then simulated with a delay removed and then added back. These first and third outputs will be identical, while the second will be shifted by one timestep.
[X,T] = simpleseries_dataset; net = timedelaynet(1:2,20); [Xs,Xi,Ai,Ts] = preparets(net,X,T); net = train(net,Xs,Ts,Xi); y1 = net(Xs) net2 = removedelay(net); [Xs,Xi,Ai,Ts] = preparets(net2,X,T); y2 = net2(Xs,Xi) net3 = adddelay(net2) [Xs,Xi,Ai,Ts] = preparets(net3,X,T); y3 = net3(Xs,Xi)