重新制作了生成直方图的函数。

Signed-off-by: dugg@lab-desk <dugg@lab-desk>
This commit is contained in:
dugg@lab-desk 2015-02-11 19:20:28 +08:00
parent 8f5fe67a6a
commit 3231d81b99
6 changed files with 471 additions and 3 deletions

83
AngelBar.m Normal file
View File

@ -0,0 +1,83 @@
function createfigure(xvector1, yvector1, xvector2, yvector2, xvector3, yvector3)
%CREATEFIGURE(XVECTOR1,YVECTOR1,XVECTOR2,YVECTOR2,XVECTOR3,YVECTOR3)
% XVECTOR1: bar xvector
% YVECTOR1: bar yvector
% XVECTOR2: bar xvector
% YVECTOR2: bar yvector
% XVECTOR3: bar xvector
% YVECTOR3: bar yvector
% Auto-generated by MATLAB on 11-Feb-2015 17:24:27
% Create figure
figure1 = figure('Name','','Color',[1 1 1]);
% Create axes
axes1 = axes('Parent',figure1,'XTick',[-0.0002 -0.0001 0 0.0001 0.0002],...
'Position',[0.0920853080568723 0.470619469026549 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes1,[-0.0003 0.0003]);
% Uncomment the following line to preserve the Y-limits of the axes
ylim(axes1,[0 11]);
box(axes1,'on');
hold(axes1,'all');
% Create bar
bar(xvector1,yvector1,'FaceColor',[0 0 0],'Parent',axes1);
% Create xlabel
xlabel('/','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create title
title('A','FontSize',13);
% Create axes
axes2 = axes('Parent',figure1,'XTick',[-0.002 -0.001 0 0.001 0.002],...
'Position',[0.350370561164917 0.466814159292035 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes2,[-0.002 0.002]);
% Uncomment the following line to preserve the Y-limits of the axes
ylim(axes2,[0 7]);
box(axes2,'on');
hold(axes2,'all');
% Create bar
bar(xvector2,yvector2,'FaceColor',[0 0 0],'Parent',axes2);
% Create xlabel
xlabel('/','FontSize',13);
% Create title
title('B','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create axes
axes3 = axes('Parent',figure1,'XTick',[-0.002 -0.001 0 0.001 0.002],...
'Position',[0.606286146026517 0.463982300884956 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes3,[-0.002 0.002]);
% Uncomment the following line to preserve the Y-limits of the axes
ylim(axes3,[0 10]);
box(axes3,'on');
hold(axes3,'all');
% Create bar
bar(xvector3,yvector3,'FaceColor',[0 0 0],'Parent',axes3);
% Create xlabel
xlabel('/','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create title
title('C','FontSize',13);

115
DeviationFigure.m Normal file
View File

@ -0,0 +1,115 @@
function createfigure(X1, YMatrix1, YMatrix2, YMatrix3, YMatrix4)
%CREATEFIGURE(X1,YMATRIX1,YMATRIX2,YMATRIX3,YMATRIX4)
% X1: vector of x data
% YMATRIX1: matrix of y data
% YMATRIX2: matrix of y data
% YMATRIX3: matrix of y data
% YMATRIX4: matrix of y data
% Auto-generated by MATLAB on 11-Feb-2015 16:31:59
% Create figure
figure1 = figure('Color',[1 1 1]);
% Create axes
axes1 = axes('Parent',figure1,'XTick',[1 4 7 10 13 16 19 22 25 28 31 33],...
'Position',[0.140663507109006 0.572508000217951 0.537061611374407 0.365998852384935],...
'FontName','Times New Roman');
hold(axes1,'all');
% Create multiple lines using matrix input to plot
plot1 = plot(X1,YMatrix1,'Parent',axes1,'LineStyle',':','Color',[0 0 0]);
set(plot1(1),'Marker','diamond','DisplayName','A');
set(plot1(2),'Marker','square','DisplayName','B');
set(plot1(3),'Marker','o','DisplayName','C');
% Create xlabel
xlabel('','FontName','');
% Create ylabel
ylabel('/p.u','FontName','Times New Roman');
% Create axes
axes2 = axes('Parent',figure1,'XTick',[2 5 8 11 14 17 20 23 26 29 32],...
'Position',[0.143033175355449 0.120301205914361 0.537914691943128 0.365998852384935],...
'FontName','Times New Roman');
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes2,[2 33]);
hold(axes2,'all');
% Create multiple lines using matrix input to plot
plot2 = plot(X1,YMatrix3,'Parent',axes2,'LineStyle',':','Color',[0 0 0]);
set(plot2(1),'Marker','diamond','DisplayName','A');
set(plot2(2),'Marker','square','DisplayName','B');
set(plot2(3),'Marker','o','DisplayName','C');
% Create xlabel
xlabel('','FontName','Times New Roman');
% Create ylabel
ylabel('%','FontName','Times New Roman');
% Create title
title('');
% Create axes
axes3 = axes('Parent',figure1,...
'XTickLabel',{'1','4','7','10','13','16','19','22','25','28','31','33'},...
'XTick',[1 4 7 10 13 16 19 22 25 28 31 33],...
'Position',[0.440758293838865 0.574607379571982 0.537914691943128 0.365998852384935]);
hold(axes3,'all');
% Create multiple lines using matrix input to plot
plot3 = plot(X1,YMatrix2,'Parent',axes3,'LineStyle',':','Color',[0 0 0]);
set(plot3(1),'Marker','diamond','DisplayName','A');
set(plot3(2),'Marker','square','DisplayName','B');
set(plot3(3),'Marker','o','DisplayName','C');
% Create xlabel
xlabel('');
% Create ylabel
ylabel('/');
% Create axes
axes4 = axes('Parent',figure1,'XTick',[2 5 8 11 14 17 20 23 26 29 32],...
'Position',[-0.490853080568712 -0.0598281717337482 0.537914691943128 0.365998852384935]);
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes4,[2 33]);
hold(axes4,'all');
% Create multiple lines using matrix input to plot
plot4 = plot(X1,YMatrix4,'Parent',axes4,'LineStyle',':','Color',[0 0 0]);
set(plot4(1),'Marker','diamond','DisplayName','A');
set(plot4(2),'Marker','square','DisplayName','B');
set(plot4(3),'Marker','o','DisplayName','C');
% Create xlabel
xlabel('');
% Create ylabel
ylabel('%');
% Create legend
legend1 = legend(axes1,'show');
set(legend1,...
'Position',[0.155301294649576 0.633902089695378 0.112559241706161 0.12206572769953],...
'FontName','');
% Create legend
legend2 = legend(axes2,'show');
set(legend2,...
'Position',[0.533220206544619 0.178635859349444 0.112559241706161 0.12206572769953],...
'FontName','');
% Create legend
legend3 = legend(axes3,'show');
set(legend3,...
'Position',[0.450281817919025 0.807479462339755 0.117298578199052 0.12206572769953],...
'FontName','');
% Create legend
legend4 = legend(axes4,'show');
set(legend4,...
'Position',[-0.098296381133102 -0.0539564029130473 0.117298578199052 0.122065727699531]);

37
OPF.m
View File

@ -143,13 +143,13 @@ plot(1:length(CaseBREA),(CaseBREA),'b:','Marker','square');
subplot(4,1,3);
hold on;
% CaseBREP=(PD-RealPD)./(RealPD+0.00001)*100;%Relative Error of PD in Case B
CaseBREP=(PD-RealPD)./RealPD;%Relative Error of PD in Case B
CaseBREP=(PD-RealPD)./RealPD*100;%Relative Error of PD in Case B
RealPD(1)=0;
plot(1:length(CaseBREP),(CaseBREP),'b:','Marker','square');
subplot(4,1,4);
hold on;
% CaseBREQ=(QD-RealQD)./(RealQD+0.00001)*100;%Relative Error of QD in Case B
CaseBREQ=(QD-RealQD)./RealQD;%Relative Error of QD in Case B
CaseBREQ=(QD-RealQD)./RealQD*100;%Relative Error of QD in Case B
CaseBREQ(1)=0;
plot(1:length(CaseBREQ),(CaseBREQ),'b:','Marker','square');
CaseBE=sqrt((sum(CaseBREV.^2)+sum(CaseBREA.^2)+sum(CaseBREP.^2)+sum(CaseBREQ.^2))/132);
@ -233,6 +233,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
voltBarCaseAX=x;
voltBarCaseAY=yy;
xlabel('Error');
ylabel('Number of buses');
title('A');
@ -246,9 +248,11 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
voltBarCaseBX=x;
voltBarCaseBY=yy;
xlabel('Error');
ylabel('Number of buses');
title('ËãÀýD');
title('ËăŔýB');
% ylim([0 4])
%Case C
subplot(1,3,3)
@ -259,6 +263,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
voltBarCaseCX=x;
voltBarCaseCY=yy;
xlabel('Error');
ylabel('Number of buses');
title('C');
@ -275,6 +281,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
angelBarCaseAX=x;
angelBarCaseAY=yy;
% ylim([0 4])
%Case B
subplot(2,2,2)
@ -285,6 +293,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
angelBarCaseBX=x;
angelBarCaseBY=yy;
% ylim([0 4])
%Case C
subplot(2,2,3)
@ -293,6 +303,8 @@ ymin=min(y);
ymax=max(y);
x=linspace(ymin,ymax,split_number); %split_number(19),
yy=hist(y,x); %
angelBarCaseCX=x;
angelBarCaseCY=yy;
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
%PD
@ -307,6 +319,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
PDBarCaseAX=x;
PDBarCaseAY=yy;
% ylim([0 4])
%Case B
subplot(2,2,2)
@ -317,6 +331,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
PDBarCaseBX=x;
PDBarCaseBY=yy;
% ylim([0 4])
%Case C
subplot(2,2,3)
@ -327,6 +343,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
PDBarCaseCX=x;
PDBarCaseCY=yy;
%QD
figure('Name','')
split_number=20;
@ -339,6 +357,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
QDBarCaseAX=x;
QDBarCaseAY=yy;
% ylim([0 4])
%Case B
subplot(2,2,2)
@ -349,6 +369,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
QDBarCaseBX=x;
QDBarCaseBY=yy;
% ylim([0 4])
%Case C
subplot(2,2,3)
@ -359,6 +381,8 @@ x=linspace(ymin,ymax,split_number); %
yy=hist(y,x); %
% yy=yy/(sum(yy)*(ymax-ymin)/split_number); %,:
bar(x,yy) %
QDBarCaseCX=x;
QDBarCaseCY=yy;
%线
fz=find(abs(plotGapA)==0);
% fz=fz(1);
@ -371,3 +395,10 @@ figure('Name','
%%
calTime=[87 61; 211 87; 108 59;];
bar(calTime,'stacked');
% figure();
% DeviationFigure(1:33,[CaseAREV;CaseBREV;CaseCREV],[CaseAREA;CaseBREA;CaseCREA],[CaseAREP,CaseBREP,CaseCREP],[CaseAREQ,CaseBREQ,CaseCREQ]);%,[CaseAREA;CaseBREA;CaseCREA],[CaseAREV;CaseBREV;CaseCREV],[CaseAREV;CaseBREV;CaseCREV]);
% VoltBar(voltBarCaseAX,voltBarCaseAY,voltBarCaseBX,voltBarCaseBY,voltBarCaseCX,voltBarCaseCY);
% AngelBar(angelBarCaseAX,angelBarCaseBY,angelBarCaseCX,angelBarCaseAY,angelBarCaseBX,angelBarCaseCY);
% AngelBar(PDBarCaseAX,PDBarCaseAY,PDBarCaseBX,PDBarCaseBY,PDBarCaseCX,PDBarCaseCY);
QDBar(QDBarCaseAX,QDBarCaseAY,QDBarCaseBX,QDBarCaseBY,QDBarCaseCX,QDBarCaseCY);

83
PDBar.m Normal file
View File

@ -0,0 +1,83 @@
function createfigure(xvector1, yvector1, xvector2, yvector2, xvector3, yvector3)
%CREATEFIGURE(XVECTOR1,YVECTOR1,XVECTOR2,YVECTOR2,XVECTOR3,YVECTOR3)
% XVECTOR1: bar xvector
% YVECTOR1: bar yvector
% XVECTOR2: bar xvector
% YVECTOR2: bar yvector
% XVECTOR3: bar xvector
% YVECTOR3: bar yvector
% Auto-generated by MATLAB on 11-Feb-2015 17:32:07
% Create figure
figure1 = figure('Name','','Color',[1 1 1]);
% Create axes
axes1 = axes('Parent',figure1,...
'Position',[0.0920853080568723 0.470619469026549 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes1,[-4 4]);
% Uncomment the following line to preserve the Y-limits of the axes
% ylim(axes1,[0 6]);
box(axes1,'on');
hold(axes1,'all');
% Create bar
bar(xvector1,yvector1,'FaceColor',[0 0 0],'Parent',axes1);
% Create xlabel
xlabel('%','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create title
title('A','FontSize',13);
% Create axes
axes2 = axes('Parent',figure1,'XTick',[-12 -6 0 6 12],...
'Position',[0.350370561164917 0.466814159292035 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes2,[-12 12]);
% Uncomment the following line to preserve the Y-limits of the axes
% ylim(axes2,[0 8]);
box(axes2,'on');
hold(axes2,'all');
% Create bar
bar(xvector2,yvector2,'FaceColor',[0 0 0],'Parent',axes2);
% Create xlabel
xlabel('%','FontSize',13);
% Create title
title('B','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create axes
axes3 = axes('Parent',figure1,'XTick',[-12 -6 0 6 12],...
'Position',[0.606286146026517 0.463982300884956 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
% xlim(axes3,[-12 12]);
% Uncomment the following line to preserve the Y-limits of the axes
% ylim(axes3,[0 5]);
box(axes3,'on');
hold(axes3,'all');
% Create bar
bar(xvector3,yvector3,'FaceColor',[0 0 0],'Parent',axes3);
% Create xlabel
xlabel('%','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create title
title('C','FontSize',13);

77
QDBar.m Normal file
View File

@ -0,0 +1,77 @@
function createfigure(xvector1, yvector1, xvector2, yvector2, xvector3, yvector3)
%CREATEFIGURE(XVECTOR1,YVECTOR1,XVECTOR2,YVECTOR2,XVECTOR3,YVECTOR3)
% XVECTOR1: bar xvector
% YVECTOR1: bar yvector
% XVECTOR2: bar xvector
% YVECTOR2: bar yvector
% XVECTOR3: bar xvector
% YVECTOR3: bar yvector
% Auto-generated by MATLAB on 11-Feb-2015 17:36:00
% Create figure
figure1 = figure('Name','','Color',[1 1 1]);
% Create axes
axes1 = axes('Parent',figure1,...
'Position',[0.0920853080568723 0.470619469026549 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes1,[-3 3]);
box(axes1,'on');
hold(axes1,'all');
% Create bar
bar(xvector1,yvector1,'FaceColor',[0 0 0],'Parent',axes1);
% Create xlabel
xlabel('%','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create title
title('A','FontSize',13);
% Create axes
axes2 = axes('Parent',figure1,'XTick',[-12 -6 0 6 12],...
'Position',[0.350370561164917 0.466814159292035 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes2,[-8 8]);
box(axes2,'on');
hold(axes2,'all');
% Create bar
bar(xvector2,yvector2,'FaceColor',[0 0 0],'Parent',axes2);
% Create xlabel
xlabel('%','FontSize',13);
% Create title
title('B','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create axes
axes3 = axes('Parent',figure1,'XTick',[-12 -6 0 6 12],...
'Position',[0.606286146026517 0.463982300884956 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes3,[-9 9]);
box(axes3,'on');
hold(axes3,'all');
% Create bar
bar(xvector3,yvector3,'FaceColor',[0 0 0],'Parent',axes3);
% Create xlabel
xlabel('%','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create title
title('C','FontSize',13);

79
VoltBar.m Normal file
View File

@ -0,0 +1,79 @@
function createfigure(xvector1, yvector1, xvector2, yvector2, xvector3, yvector3)
%CREATEFIGURE(XVECTOR1,YVECTOR1,XVECTOR2,YVECTOR2,XVECTOR3,YVECTOR3)
% XVECTOR1: bar xvector
% YVECTOR1: bar yvector
% XVECTOR2: bar xvector
% YVECTOR2: bar yvector
% XVECTOR3: bar xvector
% YVECTOR3: bar yvector
% Auto-generated by MATLAB on 11-Feb-2015 17:21:34
% Create figure
figure1 = figure('Name','','Color',[1 1 1]);
% Create axes
axes1 = axes('Parent',figure1,'XTick',[-0.0002 -0.0001 0 0.0001 0.0002],...
'Position',[0.0920853080568723 0.470619469026549 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the Y-limits of the axes
ylim(axes1,[0 7]);
box(axes1,'on');
hold(axes1,'all');
% Create bar
bar(xvector1,yvector1,'FaceColor',[0 0 0],'Parent',axes1);
% Create xlabel
xlabel('/p.u','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create title
title('A','FontSize',13);
% Create axes
axes2 = axes('Parent',figure1,...
'Position',[0.350370561164917 0.466814159292035 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes2,[-0.004 0.004]);
box(axes2,'on');
hold(axes2,'all');
% Create bar
bar(xvector2,yvector2,'FaceColor',[0 0 0],'Parent',axes2);
% Create xlabel
xlabel('/p.u','FontSize',13);
% Create title
title('B','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create axes
axes3 = axes('Parent',figure1,...
'Position',[0.606286146026517 0.463982300884956 0.20649289099526 0.372300884955752],...
'FontSize',13);
% Uncomment the following line to preserve the X-limits of the axes
xlim(axes3,[-0.004 0.004]);
% Uncomment the following line to preserve the Y-limits of the axes
ylim(axes3,[0 7]);
box(axes3,'on');
hold(axes3,'all');
% Create bar
bar(xvector3,yvector3,'FaceColor',[0 0 0],'Parent',axes3);
% Create xlabel
xlabel('/p.u','FontSize',13);
% Create ylabel
ylabel('','FontSize',13);
% Create title
title('C','FontSize',13);