应用了归一化的预测,在归一化的过程中使用了premnmx和postmnmx,并在最后给出了这两个函数的应用情况。
%scenario1 forecasting process
column=10;
for i=1:column;
SceInput(1,i)=inputSampledata(1,20)*(1.0464^i);
SceInput(2,i)=inputSampledata(2,20)*(1.0631^i);
SceInput(3,i)=inputSampledata(3,20)*(1.0872^i);
SceInput(4,i)=inputSampledata(4,20)*(1.2044^i);
SceInput(5,i)=inputSampledata(5,20)*(1.2326^i);
SceInput(6,i)=inputSampledata(6,20)*(1.0605^i);
SceInput(7,i)=2*(1.01^i);
SceInput(8,i)=42*(1.02^i);
SceInput(9,i)=inputSampledata(9,20)*(1.1426^i);
SceInput(10,i)=inputSampledata(10,20)*(1.017^i);
SceInput(11,i)=inputSampledata(11,20)*(1.0205^i);
SceInput(12,i)=inputSampledata(12,20)*(1.1336^i);
SceInput(13,i)=inputSampledata(13,20)*(1.1599^i);
SceInput(14,i)=inputSampledata(14,20)*(1.1783^i);
end
for j=1:20;
for i=1:14;
recalldata(i,j)=inputSampledata(i,j);
end
end
for j=21:30;
for i=1:14;
recalldata(i,j)=SceInput(i,j-20)
end
end
[alterinput,mininput,maxinput] = premnmx(recalldata);
%training
fvalue=sim(gwwnet,alterinput);
%data offset (converting the network output data to it original unit)
forecastvalue = postmnmx(fvalue,minoutput,maxoutput);
%plot
% waitforbuttonpress;
%
% Wait for key or mouse button press
% Syntax
% k = waitforbuttonpress
%
% Description
%
% k = waitforbuttonpress blocks the caller's execution stream
% until the function detects that the user has pressed a mouse button
% or a key while the figure window is active. The function returns 0
% if it detects a mouse button press 1 if it detects a key press
%
% Example
%
% These statements display text in the Command Window
% when the user either clicks a mouse button or
% types a key in the figure window:
% w = waitforbuttonpress;
% if w == 0
% disp('Button press')
% else
% disp('Key press')
% end
% clf;
figure;
time1=1:1:30;
time2=1:1:20;
plot(time1,forecastvalue,'r-',time2,outputSampledata,'-');
legend('预测曲线','实际曲线');
title('曲线');
xlabel('时间');ylabel('量');
%%%%%%%premnmx及postmnmx使用说明
% clc;
% clear;
% p = [1 2 3 4;
% 5 6 8 9 ];
% [p1 pmin pmax]=premnmx(p);
% p2=postmnmx(p1,pmin,pmax);
% p1
% pmin
% pmax
% p2
%
% p1 =
%
% -1.0000 -0.3333 0.3333 1.0000
% -1.0000 -0.5000 0.5000 1.0000
%
%
% pmin =
%
% 1
% 5
%
%
% pmax =
%
% 4
% 9
%
%
% p2 =
%
% 1 2 3 4
% 5 6 8 9