MATLAB: How to model one-step-ahead prediction with delays from 1 to 2 in neural network

neural network

Hi everybody,
I don't understand how to tell to my NNET (for neural network) that I want to predict a time serie one step ahead using delays from 1 to 2.
I have :
input(i) = input dimension 1x(N-1)
target(i) = target dimension 1x(N-1)
And I want to make this ind of prediction:
target ( i + 1) = fct ( input(i) + input(i-1) + input(i-2))
Is the following the right solution ?
ftdnn_net = timedelaynet([1:2],10);
p = input (3:end);
t = target(3:end);
Pi= input(1:2);
ftdnn_net = train(ftdnn_net,p,t,Pi);
I am afraid that I am using input(i) to predict target(i) which is not what I want to do. target(i) must be predicted with information available at time strictly lower than (<) i.
ex:
I want, target (3) to be predicted by input(1) and input(2)
and
target (4) to be predicted by input(1) and input(2) and input(3)
and
target (5) to be predicted by input(2) and input(3) and input(4)
and so on.
Thanks guys.

Best Answer

Think of it as
target ( i ) = fct ( input( i-3 : i-1))
ID = 1:3;
H = 10
ftdnn_net = timedelaynet( ID, H );
p = input( max(ID)+1 : end );
t = target( max(ID)+1 : end );
Pi= input( ID );
NOTE:
1. You cannot have a different number of delays for the first output.
2. ID = 0 would mean that there is no step ahead prediction.
Hope this helps.
Thank you for formally accepting my answer.
P.S. After you finish see help/doc preparets. Once you understand it, it is very handy; especially if you add feedback delays (narnet/narxnet).
Greg