负荷预测的神经BP算法MATLAB程序

更新时间:2024-03-13 23:37:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

负荷预测的神经BP算法MATLAB程序:

%休息日预测

P=[0.9161 0.8988 0.7497 1.0000 0.7926 1.0000 1.0000 0.8281 0.7184 0.6344 0.9593 0.9614 0.9641 0.7721 0.7219 1.0000 0.6958 0.7766 1.0000 1.0000 1.0000 0.6927 0.7946 1.0000 1.0000 1.0000;

1.0000 1.0000 1.0000 0.7413 1.0000 0.8699 0.8963 1.0000 0.7152 0.9032 0.9898 0.8275 1.0000 1.0000 1.0000 0.7926 0.8551 0.6657 0.9905 0.7144 1.0000 1.0000 1.0000 0.4716 0.4082 0.0970;

0.4374 0.1343 0.3729 0.1634 0.3709 0.4904 0.2517 0.8050 0.7343 0.9743 0.7459 0.9578 0.6352 0.7792 0.9362 0.8128 0.8981 0.6535 0.5572 0.1251 0.0354 0.0000 0.4245 0.3129 0.0000 0.0000;

0.4594 0.3118 0.2790 0.3089 0.0742 0.3530 0.4412 0.6017 0.0000 1.0000 1.0000 0.8794 0.8374 0.9187 0.9668 0.8280 1.0000 1.0000 0.3937 0.2353 0.3069 0.1019 0.4035 0.4195 0.6490 0.7015;

0.5458 0.2537 0.2112 0.4440 0.3613 0.3627 0.5187 0.5178 1.0000 0.7233 0.8659 1.0000 0.6578 0.9594 1.0000 0.7167 0.9254 0.8252 0.7602 0.4813 0.6830 0.5727 0.7178 0.6454 0.6612 0.7463;

0.4323 0.1194 0.2008 0.5495 0.4121 0.4542 0.2946 0.2704 0.7194 0.7233 0.8618 0.7419 0.7940 0.6184 0.5957 0.8061 0.7848 0.9027 0.8529 0.4706 0.7707 0.4153 0.7228 0.1333 0.3959 0.3433;

0.1342 0.0000 0.3677 0.2934 0.1113 0.0000 0.0000 0.0000 0.5462 0.2470 0.2419 0.6140 0.2609 0.0159 0.0702 0.1501 0.0000 0.0851 0.0000 0.0000 0.0590 0.0930 0.2178 0.1251 0.5102 0.2910;

0.4219 0.6468 0.3090 0.5302 0.1044 0.2506 0.3306 0.1656 0.5430 0.2609 0.3557 0.5380 0.2875 0.4576 0.5638 0.3069 0.4275 0.0000 0.0041 0.1433 0.0000 0.0780 0.2203 0.2816 0.3020 0.0821]';

T=[1.0000 1.0000 1.0000 0.7413 1.0000 0.8699 0.8963 1.0000 0.7152 0.9032 0.9898 0.8275 1.0000 1.0000 1.0000 0.7926 0.8551 0.6657 0.9905 0.7144 1.0000 1.0000 1.0000 0.4716;

0.4374 0.1343 0.3729 0.1634 0.3709 0.4904 0.2517 0.8050 0.7343 0.9743 0.7459 0.9578 0.6352 0.7792 0.9362 0.8128 0.8981 0.6535 0.5572 0.1251 0.0354 0.0000 0.4245 0.3129;

0.4594 0.3118 0.2790 0.3089 0.0742 0.3530 0.4412 0.6017 0.0000 1.0000 1.0000 0.8794 0.8374 0.9187 0.9668 0.8280 1.0000 1.0000 0.3937 0.2353 0.3069 0.1019 0.4035 0.4195;

0.5458 0.2537 0.2112 0.4440 0.3613 0.3627 0.5187 0.5178 1.0000 0.7233 0.8659 1.0000 0.6578 0.9594 1.0000 0.7167 0.9254 0.8252 0.7602 0.4813 0.6830 0.5727 0.7178 0.6454;

0.4323 0.1194 0.2008 0.5495 0.4121 0.4542 0.2946 0.2704 0.7194 0.7233 0.8618 0.7419 0.7940 0.6184 0.5957 0.8061 0.7848 0.9027 0.8529 0.4706 0.7707 0.4153 0.7228 0.1333;

0.1342 0.0000 0.3677 0.2934 0.1113 0.0000 0.0000 0.0000 0.5462 0.2470 0.2419 0.6140 0.2609 0.0159 0.0702 0.1501 0.0000 0.0851 0.0000 0.0000 0.0590 0.0930 0.2178

0.1251;

0.4219 0.6468 0.3090 0.5302 0.1044 0.2506 0.3306 0.1656 0.5430 0.2609 0.3557 0.5380 0.2875 0.4576 0.5638 0.3069 0.4275 0.0000 0.0041 0.1433 0.0000 0.0780 0.2203 0.2816;

0.0000 0.0182 0.0000 0.0000 0.0975 0.5651 0.0456 0.3501 0.2710 0.0000 0.0000 0.0000 0.1796 0.0000 0.0000 0.0000 0.6284 0.5714 0.4469 0.3861 0.2428 0.0120 0.0000 0.0197]';

threshold=[0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1; 0 1]; net=newff(threshold,[53,24],{'tansig','logsig'},'trainrp'); net.trainParam.epochs=1000; net.trainParam.goal=0.01; LP.lr=0.1;

net=train(net,P,T); hold on; figure;

P_test=[0.0000 0.0182 0.0000 0.0000 0.0975 0.5651 0.0456 0.3501 0.2710 0.0000 0.0000 0.0000 0.1796 0.0000 0.0000 0.0000 0.6284 0.5714 0.4469 0.3861 0.2428 0.0120 0.0000 0.0197 0.3306 0.0075]';

Out=sim(net,P_test); %绘制预报误差曲线

X=[0.3923 0.0464 0.0561 0.3037 0.0000 0.1771 0.2573 0.4885 0.9033 0.3953 0.5935 0.4958 0.0000 0.3428 0.4732 0.1012 0.4247 0.4027 0.4401 0.0749 0.3052 0.1529 0.0012 0.0000]';

plot(1:24,X-Out)

%反归一化处理30号的负荷预测值

s=[411.5 400.5 393.3 402.2 391.7 413.7 441.2 435.0 435.4 435.1 460.9 461.6 451.3 445.0 444.1 453.1 450.1 499.8 530.2 531.4 481.8 452.2 450.0 454.4;

418.0 406.6 412.5 382.1 406.8 402.9 433.7 443.2 435.1 448.7 462.4 450.5 453.2 457.9 465.9 440.8 461.2 492.5 529.5 504.7 481.8 472.7 466.6 408.8;

374.4 354.4 364.4 337.2 361.0 371.4 387.1 433.9 436.9 452.3 450.4 461.3 433.9 445.4 460.9 442.0 464.2 491.7 497.7 449.6 424.6 406.0 420.1 395.1;

376.1 365.1 357.2 348.5 339.4 360.0 400.8 424.2 367.8 453.6 462.9 454.8 444.6 453.3 463.3 442.9 471.3 514.5 485.7 459.9 440.7 412.8 418.4 404.3;

382.8 361.6 352.0 359.0 360.3 360.8 406.4 420.2 461.9 439.6 456.3 464.8 435.1 455.6 465.9 436.3 466.1 503.0 512.6 482.9 463.0 444.2 443.8 423.8;

374.0 353.5 351.2 367.2 364.0 368.4 390.2 408.4 435.5 439.6 456.1 443.4 442.3 436.3 434.2 441.6 456.3 508.1 519.4 481.9 468.2 433.7 444.2 379.6;

350.9 346.3 364.0 347.3 342.1 330.7 368.9 395.5 419.2 415.5 425.6 432.8 414.1 402.2 393.0 402.7 401.6 454.3 456.8 437.9 426.0 412.2 403.4 378.9;

373.2 385.3 359.5 365.7 341.6 351.5 392.8 403.4 418.9 416.2 431.2 426.5 415.51 427.2 431.7 412.0 431.4 448.7 457.1 451.3 422.5 411.2 403.6 392.4;

340.5 347.4 335.8 324.5 341.1 377.6 372.2 412.2 393.3 403.0 413.7 381.9 409.8 401.3 387.5 393.8 445.4 486.3 489.6 474.0 436.9 406.8 385.8 369.8;

370.9 349.1 340.1 348.1 334.0 345.4 387.5 418.8 452.8 423.0 442.9 423.0 400.3

420.7 424.6 399.8 431.2 475.2 489.1 444.9 440.6 416.2 385.9 368.1]'; for j=1:24

A(j,:)=(max(s(j,:))-min(s(j,:)))*Out(j,:)+min(s(j,:)); end

本文来源:https://www.bwwdw.com/article/p0q8.html

Top