91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

Elman神經網絡的數據預測—電力負荷預測模型研究

資源截圖

代碼片段和文件信息

%%??案例18:?基于Elman神經網絡的電力負荷預測模型研究

%%?清空環境變量

clc;
clear?all
close?all
nntwarn?off;

%%?數據載入

load?data;
a=data;

%%?選取訓練數據和測試數據

for?i=1:6
????p(i:)=[a(i:)a(i+1:)a(i+2:)];
end
%?訓練數據輸入
p_train=a(1:5:);
%?訓練數據輸出
t_train=a(4:8:);
%?測試數據輸入
p_test=p(6:);
%?測試數據輸出
t_test=a(9:);

%?為適應網絡結構?做轉置

p_train=p_train‘;
t_train=t_train‘;
p_test=p_test‘;


%%?網絡的建立和訓練
%?利用循環,設置不同的隱藏層神經元個數
nn=[7?11?14?18];
for?i=1:4
????threshold=[0?1;0?1;0?1;0?1;0?1;0?1;0?1;0?1;0?1];?%?1組輸入數據的閾值
????%?建立Elman神經網絡?隱藏層為nn(i)個神經元
????%?原語句為:net=newelm(threshold[nn(i)3]{‘tansig‘‘purelin‘});?
????net=newelm(threshold[nn(i)3]{‘tansig‘‘purelin‘}‘trainlm‘);
????%?設置網絡訓練參數
????net.trainparam.epochs=1000;
????net.trainparam.show=20;
????%?初始化網絡
????net=init(net);
????%?Elman網絡訓練
????net=train(netp_traint_train);
????%?預測數據
????y=sim(netp_test);
????%?計算誤差
????error(i:)=y‘-t_test;
end

%%?通過作圖?觀察不同隱藏層神經元個數時,網絡的預測效果

plot(1:1:3error(1:)‘-ro‘‘linewidth‘2);
hold?on;
plot(1:1:3error(2:)‘b:x‘‘linewidth‘2);
hold?on;
plot(1:1:3error(3:)‘k-.s‘‘linewidth‘2);
hold?on;
plot(1:1:3error(4:)‘c--d‘‘linewidth‘2);
title(‘Elman預測誤差圖‘)
set(gca‘Xtick‘[1:3])
legend(‘7‘‘11‘‘14‘‘18‘‘location‘‘best‘)
xlabel(‘時間點‘)
ylabel(‘誤差‘)
hold?off;

%%

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????1504??2012-03-23?20:33??elman?load?forecast.m

-----------?---------??----------?-----??----

?????????????????1504????????????????????1


評論

共有 條評論