?? forecast.m
字號:
clf reset
set(gcf,'unit','normalized','position',[0.05,0.1,0.8,0.7]);
set(gcf,'defaultuicontrolunits','normalized');
set(gcf,'defaultuicontrolfontsize',12);
set(gcf,'defaultuicontrolfontname','隸書');
set(gcf,'defaultuicontrolhorizontal','left');
str='電力能源預(yù)測';
set(gcf,'name',str,'numbertitle','off');
%set(h1_axes,'XTick','Xscal');
%數(shù)據(jù)計算
global g_num;
global k_num;
global n_num;
global o_num;
g_num=1;k_num=1;n_num=1;o_num=1;
K=[1.09898675 1.065957447 1.028942116 1.059489169 1.072322246 1.072851451 1.08938992 ...
1.094716338 ...
1.106094306 ...
1.096119043 ...
1.072647221 ...
1.062596203 ...
1.090616449 ...
1.112603306 ...
1.11354291 ...
1.105539011 ...
1.085012391 ...
1.073783515 ...
1.048922593 ...
1.020631282 ...
1.065221147 ...
1.09999189 ...
1.093966382 ....
1.114800897 ...
1.15177 1.14 1.137 1.08 1.06 1.05 1.055 1.065 1.067 1.07 1.05 1.04 1.03 1.02 1.03 1.04 1.05 1.053];
I=[2820 3006 3093 3277 3514 3770 4107 4496 4973 5451 5847 ...
6213 6776 7539 8395 9281 10070 10813 11342 11576 12331 ...
13564 14838.56 16542.04 19052.62];
for i=26:42
I(i)=I(i-1)*K(i);
end
Gc=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
G=[63 66 69 72 76 80 87 94 103 115 127 138 151 167 183 200 ...
217 237 254.238 277 299 319 334 357 391];
for i=26:42
G(i)=G(i-1)+Gc(i-25);
end
N=zeros(1,42);
O=zeros(1,42);
for i=1:42
L(i)=G(i)-I(i)/(87.6*(1-0.479195-0.005*N(i)+0.005*O(i)));
end
for i=1:42
J(i)=(I(i)/(G(i)*87.6)+0.479195-0.005*N(i)+0.005*O(i))/(I(i)/((G(i)-L(i))*87.6)+0.479195-0.005*N(i)+0.005*O(i));
end
str1='當前值=';
str2='上年值=';
str3='今年值=';
h1_axes=axes('position',[0.05,0.1,0.6,0.35]);
%Xsc=[1980:1:2020];
%set(h1_axes,'xlim',[1980 2020],'XTick',[1980:1:2020]);
t=1979:1:2020;
hbar=bar(t,L);
axis([1979 2020 -40 40]);
h2_axes=axes('position',[0.05,0.55,0.6,0.35]);
t=1979:1:2020;
hline=plot(t,J);
axis([1979 2020 0.9 1.1]);
g=0;k=1;n=1;o=1;
G_h1text=uicontrol(gcf,'style','text',... % <14>
'position',[0.67,0.7,0.13,0.1],...
'string',['G']);
G_h3text=uicontrol(gcf,'style','text',... % <14>
'position',[0.67,0.85,0.15,0.1],...
'string',['預(yù)測年參數(shù)設(shè)置']);
G_hpop=uicontrol(gcf,'style','popup',... % <17>
'position',[0.67,0.8,0.13,0.1],...
'string','2004|2005|2006|2007|2008|2009|2010|2011|2012|2013|2014|2015|2016|2017|2018|2019|2020');
G_h2text=uicontrol(gcf,'style','text',... % <14>
'position',[0.81,0.7,0.23,0.1],...
'string',[str1,sprintf('%1.4g\',g)]);
G_hslider=uicontrol(gcf,'style','slider',... % <17>
'position',[0.81,0.7,0.17,0.05],...
'max',100,'min',0,... % <19>
'sliderstep',[0.01,0.05],... % <20>
'Value',0); % <21>
G_h4text=uicontrol(gcf,'style','text',... % <14>
'position',[0.67,0.65,0.13,0.1],...
'string',[str2]);
G_h5text=uicontrol(gcf,'style','text',... % <14>
'position',[0.67,0.60,0.13,0.1],...
'string',[str3]);
K_h1text=uicontrol(gcf,'style','text',... % <14>
'position',[0.67,0.55,0.13,0.1],...
'string',['K']);
%K_hpop=uicontrol(gcf,'style','popup',... % <17>
% 'position',[0.67,0.5,0.13,0.1],...
% 'string','2004|2005|2006|2007|2008|2009|2010|2011|2012|2013|2014|2015|2016|2017|2018|2019|2020');
K_h2text=uicontrol(gcf,'style','text',... % <14>
'position',[0.81,0.55,0.23,0.1],...
'string',[str1,sprintf('%1.4g\',k)]);
K_hslider=uicontrol(gcf,'style','slider',... % <17>
'position',[0.81,0.55,0.17,0.05],...
'max',2,'min',0,... % <19>
'sliderstep',[0.02,0.02],... % <20>
'Value',1); % <21>
N_h1text=uicontrol(gcf,'style','text',... % <14>
'position',[0.67,0.35,0.13,0.1],...
'string',['N']);
% N_hpop=uicontrol(gcf,'style','popup',... % <17>
% 'position',[0.67,0.3,0.13,0.1],...
% 'string','2004|2005|2006|2007|2008|2009|2010|2011|2012|2013|2014|2015|2016|2017|2018|2019|2020');
N_h2text=uicontrol(gcf,'style','text',... % <14>
'position',[0.81,0.35,0.23,0.1],...
'string',[str1,sprintf('%1.4g\',n)]);
N_hslider=uicontrol(gcf,'style','slider',... % <17>
'position',[0.81,0.35,0.17,0.05],...
'max',3,'min',-3,... % <19>
'sliderstep',[0.1,0.1],... % <20>
'Value',1);% <21>
O_h1text=uicontrol(gcf,'style','text',... % <14>
'position',[0.67,0.15,0.13,0.1],...
'string',['O']);
% O_hpop=uicontrol(gcf,'style','popup',... % <17>
% 'position',[0.67,0.1,0.13,0.1],...
% 'string','2004|2005|2006|2007|2008|2009|2010|2011|2012|2013|2014|2015|2016|2017|2018|2019|2020');
O_h2text=uicontrol(gcf,'style','text',... % <14>
'position',[0.81,0.15,0.23,0.1],...
'string',[str1,sprintf('%1.4g\',o)]);
O_hslider=uicontrol(gcf,'style','slider',... % <17>
'position',[0.81,0.15,0.17,0.05],...
'max',3,'min',-3,... % <19>
'sliderstep',[0.1,0.1],... % <20>
'Value',1);% <21>
set(G_hslider,'callback',[... % <30>
'g=get(gcbo,''value'');',... % <31>
'[I,J,K,N,O,Gc,L,G]=G_callcheck(G_h2text,G_h5text,str1,g,I,G,K,N,O,Gc);']); % <32>
set(K_hslider,'callback',[... % <30>
'k=get(gcbo,''value'');',... % <31>
'[I,J,K,N,O,Gc,L]=K_callcheck(K_h2text,str1,k,I,G,K,N,O,Gc);']); % <32>
set(N_hslider,'callback',[... % <30>
'n=get(gcbo,''value'');',... % <31>
'[I,J,K,N,O,Gc,L]=N_callcheck(N_h2text,str1,n,I,G,K,N,O,Gc);']); % <32>
set(O_hslider,'callback',[... % <30>
'o=get(gcbo,''value'');',... % <31>
'[I,J,K,N,O,Gc,L]=O_callcheck(O_h2text,str1,o,I,G,K,N,O,Gc);']); % <32>
%顯示G、K、N、O的當前值;設(shè)定需要G、K、N、O的年份
set(G_hpop,'callback',[... % <30>
'[I,J,K,N,O,Gc,L]=Gpopup_callcheck(G_hpop,G_h2text,G_h4text,G_h5text,K_h2text,N_h2text,O_h2text,str1,I,G,K,N,O,Gc);']); % <32>
% set(G_hpop,'callback',[... % <30>
% '[I,J,K,N,O,Gc,L]=Kpopup_callcheck(G_hpop,K_h2text,str1,I,G,K,N,O,Gc);']); % <32>
%set(G_hpop,'callback',[... % <30>
% '[I,J,K,N,O,Gc,L]=Npopup_callcheck(G_hpop,N_h2text,str1,I,G,K,N,O,Gc);']); % <32>
%set(G_hpop,'callback',[... % <30>
% '[I,J,K,N,O,Gc,L]=Opopup_callcheck(G_hpop,O_h2text,str1,I,G,K,N,O,Gc);']); % <32>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -