´ó¼ÒºÃ£¬ÇóÖú£¡
ÊÖÍ·ÓÐÒ»¸ö´óÖÂÒÔÌìΪÖÜÆÚµÄСʱÊý¾Ý£¬¹²4000¸öÊý¾Ý¡£
ÎÒÏë×öÒ»¸öʵÑ飬ÓÃÇ°ÃæµÄ2400¸öÊý¾Ý½¨Á¢Ò»¸öÍøÂ磬ÔÚÕâ¸öÍøÂçÄÚµÚ1¡«12¸öÊý¾ÝÔ¤²â³öµÚ13¸öÊý¾Ý£¬
µÚ2¡«13¸öÊý¾ÝÔ¤²â³öµÚ14¸öÊý¾Ý¡£¡£¡£
×îºóÏ£Íû»ùÓÚÕâ¸öÍøÂ磬ÀûÓõÚ2389¡«2400¸öÊý¾ÝÀ´Ô¤²âµÚ2401¸öÊý¾Ý¡£
È»ºóÈç´ËÑ»·½¨Á¢ÍøÂ磬Ԥ²â2402, 2403, ¡£¡£¡£µÄ¹ý³Ì¡£
µ«ÊÇÏÖÔڵõ½µÄ½á¹û×ÜÊÇûÓÐÌåÏÖ³öÔ¤²âÀ´£¬È總ͼËùʾ£¬À¶ÏßÊÇÔʼֵ£¬ºìÏßÊÇÕâÑùµÄÍøÂçÔ¤²âÖµ£¬ÂÌÏßÊǽ«Õâ¸öÔ¤²âÖµµÄÏßÏò×óÒÆ¶¯Ò»Ïµõ½µÄ¡£
Çó´óÏÀÖ¸µãÓ¦¸ÃÈçºÎÐ޸ģ¿
Ô´³ÌÐòÈçÏÂ
%%%%% load the data and forecast
%%%%% it's not working.....
warning('off'); %#ok<WNOFF>
close all
clear
clc
load ttt
strip=12;
lenth=strip*200;
times=20;
err=zeros(times,strip);
rec_t=zeros(times,strip);
rec_tf=zeros(times,strip);
for time=1:times
msg = sprintf('forecasting iteration %g/%g...\n',time,times);
fprintf('%s',msg);
signal=ttt(time:time+lenth-1); %%% lenth
%%%% strip data to predict 'strip+1' point
in=zeros(strip,lenth-strip);
for i=1: (lenth-strip)
in(:,i)=signal(i:i+strip-1);
end
tgt=signal(strip+1:lenth);
in_f=signal(lenth-strip+1:lenth);
in_f=reshape(in_f,strip,1);
%%%%%%%%%%%%%% network %%%%%%%%%%%%%%%%
net=newff(minmax(in),[strip*4,1],{'purelin','purelin'},'trainlm');
net.trainParam.epochs=1000; %
nettrainParam.goal=0.001; %
[net,tr,Y,E]=train(net,in,tgt);
% % %%%%%%%%%%% chek the network %%%%%%%%%%%%%%%%
% % out=sim(net,in);
% % figure
% % plot(reshape(tgt,1,strip*(cnt_strip-1)),'r-*');
% % hold on
% % plot(reshape(out,1,strip*(cnt_strip-1)),'b-d');
% % legend('orignal','net(in)');
% %%%%%%%%%%%%% prediction %%%%%%%%%%%%%%%
out_f=sim(net,in_f);
%%%%%% record the series
rec_t(time,1)=ttt(time+lenth);
rec_tf(time,1)=out_f;
err(time,1)=rec_tf(time,1)-rec_t(time,1);
end
figure;
plot(lenth+1:lenth+times,rec_t(:,1),'b-*');
hold on
plot(lenth+1:lenth+times,rec_tf(:,1),'r');
hold on
plot(lenth:lenth+times-1,rec_tf(:,1),'g-o');
legend('orignal','prediction','left-shifted');
title(strcat('pred == ',num2str(1,'%2.2d')));
![ÈçºÎÈ˹¤Éñ¾ÍøÂçÀ´Ô¤²âÏÂÒ»¸öÊýÖµ£¿£¿£¿]()
untitled.jpg![ÈçºÎÈ˹¤Éñ¾ÍøÂçÀ´Ô¤²âÏÂÒ»¸öÊýÖµ£¿£¿£¿-1]()
untitled.jpg
[ Last edited by gohomeba on 2014-3-6 at 10:04 ] |