NARX神经网络多步和单步预测.pdf
文本预览下载声明
% Solve an Autoregression Problem with External Input with a NARX Neural
Network解决一个NARX神经网络的外部输入自回归问题
% Script generated by Neural Time Series app脚本由神经时间序列程序生成
% Created 28-Mar-2017 10:42:15
%
% This script assumes these variables are defined:此脚本假设以下变量已定义:
%
% in - input time series.in-输入时间序列
% out - feedback time series.out-反馈时间序列
%tonndata/fromnndata把数据转化为标准神经网络格式
X = tonndata(in,false,false);
T = tonndata(out,false,false);
% 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. Suitable in low memory situations.
trainFcn = trainlm; % Levenberg-Marquardt backpropagation.
% Create a Nonlinear Autoregressive Network with External Input
inputDelays = 1:2;
feedbackDelays = 1:2;
hiddenLayerSize = 10;
net =
narxnet(inputDelays,feedbackDelays,hiddenLayerSize,open,trainFcn);
% Choose Input and Feedback Pre/Post-Processing Functions选择输入和反馈前/
后处理功能
% Settings for feedback input are automatically applied to feedback output
反馈输入的设置将自动应用于反馈输出
% For a list of all processing functions type: help nnprocess
% Customize input parameters at: net.inputs{i}.processParam删除矩阵的行定值。
映射矩阵行的最小值和最大值为[ 1 - 1 ]
% Customize output parameters at: net.outputs{i}.processParam删除矩阵的行定
值。映射矩阵行的最小值和最大值为[ 1 - 1 ]
net.inputs{1}.processFcns = {removeconstantrows,mapminmax};
net.inputs{2}.processFcns = {removeconstantrows,mapminmax};
% Prepare the Data for Training and Simulation准备数据用于训练和模拟
% The function PREPARETS prepares timeseries data for a particular network,
preparets功能,为一个特定的网络准备时间序列数据,
% shifting time by the minimum amount to fill input states and layer
% states. Using PREPARETS allows you to keep your original time series data
% unchanged, while easily customizing it for networks with differing
% numbers of delays, with open loop or closed loop feedback modes.
移动时间的最小量从而填写输入状态和层的状态
显示全部