您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 经营企划 > 风功率预测matlab程序清单
NATLAB程序清单closeallclearechoonclc%NEWFF——生成一个新的前向神经网络%TRAIN——对BP神经网络进行训练%SIM——对BP神经网络进行仿真%定义训练样本%Ptest为测试输入矢量Ptest=xlsread('数据表格.xls','sheet2','A1:A864');FlattenedData3=Ptest(:)';[MappedFlattened3,ps3]=mapminmax(FlattenedData3);MappedData3=reshape(MappedFlattened3,size(Ptest));%Ttest为测试目标矢量Ttest=xlsread('数据表格.xls','sheet2','A865:A1728');FlattenedData4=Ttest(:)';MappedFlattened4=mapminmax(FlattenedData4);MappedData4=reshape(MappedFlattened4,size(Ttest));%创建一个新的前向神经网络net=newff(minmax(MappedData3'),[16,1],{'logsig','purelin'},'traingdm');%设置训练参数net.trainParam.show=100;%训练显示间隔net.trainParam.lr=0.3;%训练速率(学习步长)net.trainParam.mc=0.9;%动量项系数net.trainParam.epochs=500000;%最大训练次数net.trainParam.goal=0.001;%最小均方根误差%调用TRAINGDM算法训练BP网络[net,tr]=train(net,MappedData3',MappedData4');%P为输入矢量P=xlsread('数据表格.xls','sheet1','A433:A576');FlattenedData1=P(:)';[MappedFlattened1,ps1]=mapminmax(FlattenedData1);%数据归一化MappedData1=reshape(MappedFlattened1,size(P));%重新调整矩阵的行数、列数%T为目标矢量T=xlsread('数据表格.xls','sheet1','A577:A720');FlattenedData2=T(:)';MappedFlattened2=mapminmax(FlattenedData2);MappedData2=reshape(MappedFlattened2,size(T));%对BP网络进行仿真A=sim(net,MappedData1');out1=mapminmax('reverse',A,ps1);%结果分析figure(1)plot(out1,':og')holdonplot(T,'-*');legend('预测输出','期望输出')title('BP网络预测输出','fontsize',12)ylabel('函数输出','fontsize',12)xlabel('样本','fontsize',12)%预测误差out=out1'error=out-T;errorsum=sum(abs(error))figure(2)plot(error,'-*')title('BP网络预测误差','fontsize',12)ylabel('误差','fontsize',12)xlabel('样本','fontsize',12)figure(3)plot((out-T)./T,'-*');title('神经网络预测误差百分比')
本文标题:风功率预测matlab程序清单
链接地址:https://www.777doc.com/doc-3697871 .html