1 主要内容
这个程序参考《考虑时空相关性的风电功率预测误差建模与分析》,今天把这个程序分享给大家,大家可以学习一下画图技巧以及数据分析方面的知识。
2 部分程序
%% 清空环境变量 clc clear all; %% 提取数据 data=xlsread('实验数据.xlsx',1); %% 提取对应各段中点位置处的误差值 error_fenbu_1=[]; for i=1:size(data,1) if data(i,3)>=220 && data(i,3)<=240 error_fenbu_1(i)=data(i,8); else error_fenbu_1(i)=0; end end error_1=error_fenbu_1(find(error_fenbu_1~=0)); error_fenbu_2=[]; for i=1:size(data,1) if data(i,3)>=670&&data(i,3)<=690; error_fenbu_2(i)=data(i,8); else error_fenbu_2(i)=0; end end error_2=error_fenbu_2(find(error_fenbu_2~=0)); error_fenbu_3=[]; for i=1:size(data,1) if data(i,3)>=1128 && data(i,3)<=1148; error_fenbu_3(i)=data(i,8); else error_fenbu_3(i)=0; end end error_3=error_fenbu_3(find(error_fenbu_3~=0)); error_fenbu_4=[]; for i=1:size(data,1) if data(i,3)>=1585&&data(i,3)<=1605; error_fenbu_4(i)=data(i,8); else error_fenbu_4(i)=0; end end error_4=error_fenbu_4(find(error_fenbu_4~=0)); error_fenbu_5=[]; for i=1:size(data,1) if data(i,3)>=2040&&data(i,3)<=2060; error_fenbu_5(i)=data(i,8); else error_fenbu_5(i)=0; end end error_5=error_fenbu_5(find(error_fenbu_5~=0)); error_fenbu_6=[]; for i=1:size(data,1) if data(i,3)>=2495 && data(i,3)<=2515; error_fenbu_6(i)=data(i,8); else error_fenbu_6(i)=0; end end error_6=error_fenbu_6(find(error_fenbu_6~=0)); error_fenbu_7=[]; for i=1:size(data,1) if data(i,3)>=2950&&data(i,3)<=2970; error_fenbu_7(i)=data(i,8); else error_fenbu_7(i)=0; end end error_7=error_fenbu_7(find(error_fenbu_7~=0)); error_fenbu_8=[]; for i=1:size(data,1) if data(i,3)>=3406 && data(i,3)<=3426; error_fenbu_8(i)=data(i,8); else error_fenbu_8(i)=0; end end error_8=error_fenbu_8(find(error_fenbu_8~=0)); error_fenbu_9=[]; for i=1:size(data,1) if data(i,3)>=3860&&data(i,3)<=3880; error_fenbu_9(i)=data(i,8); else error_fenbu_9(i)=0; end end error_9=error_fenbu_9(find(error_fenbu_9~=0)); error_fenbu_10=[]; for i=1:size(data,1) if data(i,3)>=4317&&data(i,3)<=4337; error_fenbu_10(i)=data(i,8); else error_fenbu_10(i)=0; end end error_10=error_fenbu_10(find(error_fenbu_10~=0)); %% 拟合分布—求取t分布参数进行拟合 error_values=-3000:0.5:3000; pd_1= fitdist(error_1','tLocationScale'); desity_1= pdf(pd_1,error_values); pd_2= fitdist(error_2' , 'tLocationScale' );desity_2= pdf(pd_2,error_values); pd_3= fitdist(error_3','tLocationScale'); desity_3= pdf(pd_3,error_values); pd_4= fitdist(error_4' , 'tLocationScale' );desity_4= pdf(pd_4,error_values); pd_5= fitdist(error_5','tLocationScale');