您现在的位置:首页 >> 技术文章 >> MATLAB技术 >> 内容

MATLAB代做|FPGA代做-小波神经网络电力负荷预测

时间:2020-10-21 21:39:46 点击:

  核心提示:MATLAB代做|FPGA代做-小波神经网络电力负荷预测...
clc;
clear;
close all;
p=[ 0.6800 0.3610 0.6800 0.3317 0.6751 0.3288 0.3317
0.7649 0.3317 0.7122 0.2917 0.7122 0.2732 0.2322
0.7327 0.2322 0.6429 0.2195 0.6263 0.2244 0.2273
0.6673 0.2273 0.7054 0.3220 0.7454 0.3493 0.3629
0.8000 0.3629 0.5922 0.2341 0.6283 0.2000 0.2927
0.5502 0.2927 0.5980 0.3805 0.6107 0.3463 0.3610
0.6244 0.3610 0.7600 0.4107 0.7278 0.4000 0.3102
0.6771 0.3102 0.7502 0.4098 0.7561 0.3024 0.2976 
0.7571 0.2976 0.7298 0.2829 0.7171 0.3141 0.3551
0.6546 0.3551 0.6566 0.3220 0.6215 0.3512 0.3707
0.6468 0.3707 0.6751 0.3288 0.7649 0.3317 0.3220
0.7405 0.3220 0.7122 0.2732 0.7327 0.2322 0.2020
0.7015 0.2020 0.6263 0.2244 0.6673 0.2273 0.2341
0.6654 0.2341 0.7454 0.3493 0.8000 0.3629 0.2127
0.7980 0.2127 0.6283 0.2000 0.5502 0.2927 0.3122
0.5766 0.3122 0.6107 0.3463 0.6244 0.3610 0.3805
0.6595 0.3805 0.7278 0.4000 0.6771 0.3102 0.2829
0.6859 0.2829 0.7561 0.3024 0.7571 0.2976 0.2907
0.7483 0.2907 0.7171 0.3141 0.6546 0.3551 0.4088
0.5590 0.4088 0.6215 0.3512 0.6039 0.3707 0.4098
0.6020 0.4098 0.6459 0.2654 0.6429 0.2537 0.2634
0.6332 0.3024 0.7649 0.3317 0.7405 0.3220 0.3190
0.7249 0.3190 0.7327 0.2322 0.7015 0.2020 0.2098
0.7015 0.2098 0.6673 0.2273 0.6654 0.2341 0.2361
0.6390 0.2361 0.8000 0.3629 0.7980 0.2127 0.2215
0.7366 0.2215 0.5502 0.2927 0.5766 0.3122 0.3580
0.5863 0.3580 0.6244 0.3610 0.6595 0.3805 0.3776
0.6810 0.3776 0.6712 0.3102 0.7366 0.2829 0.3688
0.7502 0.3688 0.7571 0.2976 0.7483 0.2907 0.2829
0.7112 0.2829 0.6546 0.3551 0.5590 0.4088 0.4166
0.5756 0.4166 0.6039 0.3707 0.6020 0.4098 0.2634
0.6527 0.2829 0.6468 0.3707 0.6332 0.3024 0.2946
0.6283 0.2946 0.7405 0.3220 0.7249 0.3190 0.3171
0.6800 0.3171 0.7015 0.2020 0.7015 0.2098 0.2146
0.6702 0.2146 0.6654 0.2341 0.6390 0.2361 0.2420
0.6361 0.2420 0.7980 0.2127 0.7366 0.2215 0.2537
0.7063 0.2537 0.5766 0.3122 0.5863 0.3580 0.3707
0.5863 0.3707 0.6595 0.3805 0.6810 0.3776 0.3922 
0.6702 0.3922 0.6859 0.2829 0.6605 0.3688 0.3512
0.6712 0.3512 0.7483 0.2907 0.7112 0.2829 0.3512
0.6898 0.3512 0.5590 0.4088 0.5756 0.4166 0.2732
0.6263 0.2732 0.6020 0.4098 0.7171 0.2634 0.2663
0.6576 0.3024 0.6332 0.3024 0.6283 0.2946 0.3395
0.6771 0.3395 0.7249 0.3190 0.6800 0.3171 0.3112
0.6956 0.3112 0.7015 0.2098 0.6702 0.2146 0.2166
0.6615 0.2166 0.6390 0.2361 0.6361 0.2420 0.2605
0.6595 0.2605 0.7366 0.2215 0.7063 0.2537 0.2790
0.6361 0.2790 0.5863 0.3580 0.5863 0.3707 0.3698
0.6049 0.3698 0.6810 0.3776 0.6702 0.3922 0.3688
0.7132 0.3688 0.6605 0.3688 0.6712 0.3512 0.3737
0.7366 0.3737 0.7112 0.2829 0.6898 0.3512 0.3122
0.7327 0.3122 0.5756 0.4166 0.6263 0.2732 0.3249
0.6459 0.3249 0.7171 0.2634 0.5863 0.2663 0.3054

];
P=p';
t=[0.7156; 0.6383 ; 0.4813; 0.8000; 0.2000; 0.3781; 0.5047
0.6969; 0.4508; 0.3289; 0.6570 ; 0.5633; 0.4766; 0.7953
0.2633; 0.4625; 0.5258; 0.6758; 0.2211; 0.3242; 0.4578
0.6195; 0.5633; 0.4133; 0.6477; 0.2867; 0.5141; 0.6805
0.5867; 0.2609; 0.6008; 0.3875; 0.5117; 0.4883; 0.4063
0.5750; 0.2867; 0.4883 ; 0.4906; 0.5352; 0.3828; 0.2867
0.5047; 0.5492; 0.4672; 0.4625; 0.4063; 0.3313; 0.5914
0.6477; 0.6383; 0.4297; 0.2914]; 

S0=P;
L0=t;
%产生随机矩阵以便随机调用训练数据
Q=length(S0);
q=randperm(Q);
tic;
%初始化网络 
IN=7; 
HN=15;
ON=1;
N=2000;
derros=zeros(1,(N+2));
studyspace=zeros(1,(N+2));
studyspace(1,2)=0.002;
amlf=1.001;
betat=0.999;
kkk=1.04;
mc=0.001;
W11=[0.57803  -0.81102  0.18012  0.10268   0.32524  -0.028538  -0.19873
-0.44394  0.25767  -0.36907  0.048958  0.42076  -0.25711  0.24399
0.8522  0.70985  -0.87198  -0.06745  0.67518  0.43481  0.49571
-0.69107  -0.41622  -0.12705  -0.7745  0.57933  0.61505   -0.074104
-0.40238  0.41219  -0.52002  0.80712  -0.18182  -0.10156  -0.39506
0.31407  -0.43394  -0.17706  -0.11463  -0.012488  0.57082  0.33973
0.50655  -0.12576  0.72357  0.39024  0.59953  0.41134  0.061182
-0.48433  0.31078  0.17231  0.80862  0.46106  0.1477  -0.11013
-0.28956  0.14955  -0.50608  0.011129  0.21663  0.31095  -0.24155
-0.017692  0.11483  0.66249  0.1723  -0.22655  0.080542  0.49293
-0.28408  0.064576   0.24326  -0.29602  0.70752  0.40717  -0.8481
-0.069477  0.2029  -0.37584  0.1304  -0.48761  -0.091448  -0.27688
0.36129  0.45526  -0.50142  0.035218  -0.13505  0.65531  0.10315
0.1264  0.64161  0.56122  -0.46677   -0.20422  0.37889  0.19053
0.2917  0.30811  0.5416  0.12779  0.64049  0.65329  -0.3501];
W22=[0.77823 -0.054322 0.52815 -0.17024 -0.032066  -0.4254 -0.019818 -0.95672 0.31898  -0.051685 0.3446 0.23626 0.22709 -0.68908 -0.14793];

B11=[0.56197
-0.42622
0.30777
0.17433
-0.11183
0.7182
-0.0040364
-0.20059
-0.75959
0.18479
0.66866
-0.69881
0.2667
0.14018
-0.26778];

B22=[-0.48075
-0.34632 
0.69805
0.26556
-0.32412
-0.40232
0.47171
0.37732
0.46468
-0.29359
0.77051
-0.32433
-0.11682
0.50807
-0.19973];

v(:,:,2)=W11;
w=zeros(1,HN,N+2);
%W2(:,:,1)=rand(1,S1);
w(:,:,2)=W22;
a=zeros(1,HN,N+2);
a(:,:,2)=B11';
b=zeros(1,HN,N+2);
b(:,:,2)=B22';
%cshab;
mse=zeros(1,N+2);
ee=zeros(1,N+2);

%数据进行训练
for n=3:(N+2)

wdel=zeros(1,HN);
vdel=zeros(HN,IN); 
adel=zeros(1,HN);
bdel=zeros(1,HN);
wincrease=zeros(1,HN);
vincrease=zeros(HN,IN);
aincrease=zeros(1,HN);
bincrease=zeros(1,HN);
m=1;
while m<Q+1
t2=q(m);
in=S0(:,t2);
tea=L0(t2);
r=zeros(1,HN); 
z=zeros(1,HN);
dz=zeros(1,HN);
s=0;
for j=1:HN
for i=1:IN
r(1,j)=r(1,j)+v(j,i,n-1)*in(i,1);
end
b1=b(1,j,n-1);
a1=a(1,j,n-1);
z(1,j)=hfun(r(1,j),b1,a1);
dz(1,j)=dhfun(r(1,j),b1,a1);
s=s+w(1,j,n-1)*z(1,j); 
end
y=sigmoid(s);
EEE=sqrt(abs(y-tea));
for j=1:HN
wdel(1,j)=wdel(1,j)+(tea-y)*z(1,j);
for i=1:IN
vdel(j,i)=vdel(j,i)+(tea-y)*w(1,j,n-1)*dz(1,j)*in(i,1)/a(1,j,n-1);
end
adel(1,j)=adel(1,j)+(tea-y)*w(1,j,n-1)*dz(1,j)*((r(1,j)-b(1,j,n-1))/a(1,j,n-1))/a(1,j,n-1); 
bdel(1,j)=bdel(1,j)+(tea-y)*w(1,j,n-1)*dz(1,j)/a(1,j,n-1);
end
m=m+1;
derros(1,n)=derros(1,n)+abs(tea*log(y)+(1-tea)*log(1-y));


mse(1,n)=mse(1,n)+(y-tea).^2;
MSE(1,n)=sqrt(mse(1,n));
end
%plot(n,EEE); 
ee(1,n)=EEE;
for j=1:HN
wdel(1,j)=-wdel(1,j);
for i=1:IN
vdel(j,i)=-vdel(j,i);
end
end
derros(1,n)=-derros(1,n);

% 学习速率的调整
if derros(n)<derros(n-1)
studyspace(1,n)=amlf*studyspace(1,n-1); 
end
if derros(n)>=kkk*derros(n-1)
studyspace(1,n)=betat*studyspace(1,n-1);
end
for j=1:HN
wincrease(1,j)=-studyspace(1,n)*wdel(1,j)+mc*(w(1,j,n-1)-w(1,j,n-2));
w(1,j,n)=w(1,j,n-1)+wincrease(1,j);
for i=1:IN
vincrease(j,i)=-studyspace(1,n)*vdel(j,i)+mc*(v(j,i,n-1)-v(j,i,n-2));
v(j,i,n)=v(j,i,n-1)+vincrease(j,i);
end
aincrease(1,j)=-studyspace(1,n)*adel(1,j)+mc*(a(1,j,n-1)-a(1,j,n-2));
a(1,j,n)=a(1,j,n-1)+aincrease(1,j); 
bincrease(1,j)=-studyspace(1,n)*bdel(1,j)+mc*(b(1,j,n-1)-b(1,j,n-2));
b(1,j,n)=b(1,j,n-1)+bincrease(1,j);
end
end
%网络误差曲线
toc
plot(MSE(4:N+2)/53);

联系:highspeedlogic

QQ :1224848052

微信:HuangL1121

邮箱:1224848052@qq.com

网站:http://www.mat7lab.com/

网站:http://www.hslogic.com/

微信扫一扫:

作者:小波神经网络 来源:小波神经网络
  • 您是如何找到本站的?
  • 百度搜索
  • Google搜索
  • 查阅资料过程中
  • 论坛发现
  • 百度贴吧发现
  • 朋友介绍
本站最新成功开发工程项目案例
相关评论
发表我的评论
  • 大名:
  • 内容:
  • matlab代做|matlab专业代做|matlab淘宝代做|python人工智能代做|FPGA项目合作|C代做|C++代做(www.hslogic.com) © 2020 版权所有 All Rights Reserved.
  • Email:highspeed_logic@163.com 站长QQ: 1224848052

    专业代做/代写/承接、MATLAB、SIMULINK、FPGA项目、博士/硕士/本科毕业设计、课题设计、论文,毕业论文,Coursework、Eassy、Assignment