MATLAB: The Understanding of the process of (Multi-step Forecasting using “NARX”)

multi-step predictionnarx

Dears.. I am doing multi step foecasting for wind speed for my university project.. but I am stuck… so I used simple data "y=x^2" to check the output as I need to understand how multi step is done when I am using close loop..
read almost all post regarding narx, but still I did not reached to what I am looking for..
I want to undertand the multi step procedure so it will be easy for me to use it on my data..
I have wind speed data for 1.5 year and external inputs I am using " pressure, humidity, and temperature " I am getting the one step ahead prediction and its working with fine, but I need to know how I can get 30 mint ahead prediction which is 3 step ahead for my data as my data interval is for 10 mint.
however, I used simple data to check 1st how multi step is working so that I can use it for my data.. kindly check below codes when I used closed loop with delay I got the outputs (square) of the input ( for last step it was approximately 400 as square of 20) and when I used the remove delay function, then I got the last step output one step ahead ( for 20 I got square of 21 ) this what I wanted.. but how to get 3 step ahead, for example if last input is 20, I want to get output for 23 ??
please support//
x=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
y=[1,4,9,16,25,36,49,64,81,100,121,144,169,196,225,256,289,324,361,400];
inputSeries = con2seq(x);
targetSeries = con2seq(y);
inputDelays = 1:2;
feedbackDelays = 1:2;
hiddenLayerSize = 10;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);
[inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,{},targetSeries);
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[net,tr] = train(net,inputs,targets,inputStates,layerStates);
outputs = net(inputs,inputStates,layerStates);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)
figure, plotperform(tr)
figure;
plot (cell2mat (targets),'r');
hold
plot(cell2mat (outputs) ,'b');
netc = closeloop(net);
netc.name = [net.name ' - Closed Loop'];
view(netc)
[xc,xic,aic,tc] = preparets(netc,inputSeries,{},targetSeries);
yc = netc(xc,xic,aic);
perfc = perform(netc,tc,yc)
figure;
plot (cell2mat(tc),'r');
hold
plot(cell2mat (yc),'b');
nets = removedelay(net);
nets.name = [net.name ' - Predict One Step Ahead'];
view(nets)
[xs,xis,ais,ts] = preparets(nets,inputSeries,{},targetSeries);
ys = nets(xs,xis,ais);
earlyPredictPerformance = perform(nets,ts,ys)
figure;
plot (cell2mat (ts),'r');
hold
plot(cell2mat (ys),'b');
Many Many Thanks// BR// Saira AL Zadjali

Best Answer

NARXNET requires an input. If you do not have a future input you can do the following
1. DESIGN 2 NARNETS: one for input and one for output
2. Then you can use the output NARNET to predict the
future output
3. IN ADDITION you can use the input NARNET to predict
the future input
4. THEN use the predicted future input with NARXNET to
also predict the future output.
HOWEVER, before you design any nets,
1. Obtain the autocorrelation functions of the input and
output
AND
2. Obtain the crosscorrelation function of the input and output.
THEN
3. Obtain the significant delays to determine what are
the most effective lags to use in NARNET and NARXNET.
I have written a sufficient number of explanatory posts in BOTH the NEWSGROUP (comp.soft-sys.matlab) and ANSWERS.
Thank you for formally accepting my answer
Greg