format compact
% data settings
N = 249; % number of samples
Nu = 224; % number of learning samples
y = Data;% Input your data
% prepare training data
yt = con2seq(y(1:Nu)‘);
% prepare test data
yv = con2seq(y(Nu+1:end)‘);
% Choose a Training Function
% For a list of all training functions type: help nntrain
% ‘trainlm‘ is usually fastest.
% ‘trainbr‘ takes longer but may be better for challenging problems.
% ‘trainscg‘ uses less memory. NTSTOOL falls back to this in low memory situations.
trainFcn = ‘trainlm‘; % Levenberg-Marquardt
% Create a Nonlinear Autoregressive Network
feedbackDelays = 1:5;
hiddenLayerSize = 40;
net = narnet(feedbackDelays,hiddenLayerSize,‘open‘,trainFcn);
[Xs,Xi,Ai,Ts] = preparets(net,{},{},yt);
% train net