⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mfe_pricef_plots.m

📁 Modeling and Forecasting Electricity Loads and Prices: A Statistical Approach" by Rafa&#322 Weron, p
💻 M
字号:
function mfe_pricef_plots(result,obj1,obj2);
%MFE_PRICEF_PLOTS Auxiliary routine for STARTARX, -GARCH, -TARX.
%	MFE_PRICEF_PLOTS(RESULT,OBJ1,OBJ2) plots forecasting results contained
%	in matrix RESULTS. OBJ1 is a pointer to confidence interval checkboxes.
%	OBJ2 is a pointer to price cap checkbox.
%
%   Format of RESULTS:
%       date, hour, actual price, price forecast, capped price forecast, 
%       [{lcl ucl gauss, lcl ucl npar}, 
%       price capped {lcl ucl gauss, lcl ucl npar}] as many times as there 
%       are confidence levels (but no more than 3); a max of 29 columns in 
%       total.
%
%   Gaussian intervals are in plotted green, non-parametric in black.
%   Confidence interval line styles are {'--','-.',':'}.
%
%   Reference(s):
%   [1] R.Weron (2007) "Modeling and Forecasting Electricity Loads and 
%   Prices: A Statistical Approach", Wiley, Chichester.

%   Written by Adam Misiorek and Rafal Weron (2006.09.22)
%   Copyright (c) 2006 by Rafal Weron

[N,M] = size(result);

% price forecast column
colnum = 5;
% column number modifier
colnummod = 4;
if get(obj2,'value')
    colnum=4;
    colnummod=0;
end;

h = figure(3);
set(h,'name','Price','numbertitle','off');
% price
plot(1:N,result(:,3),'r')
hold on
% price forecast
plot(1:N,result(:,colnum),'b','linewidth',2);

h = figure(4);
set(h,'name','Price deviation','numbertitle','off');
% price=0
plot([0,N+1],[0,0],'r')
hold on
% price forecast - price
plot(result(:,colnum)-result(:,3),'b','linewidth',2);

% define line styles
lstyle={'--','-.',':'};

for i=1:(M-5)/8
    % Gaussian intervals
    if get(obj1(1),'value')
        figure(3)
        plot(([1;1]*(1:N))',result(:,(i-1)*8+colnummod+[6,7]),'g','linestyle',lstyle{i});
        figure(4);
        plot(1:N,result(:,(i-1)*8+colnummod+6)-result(:,3),'g',...
            1:N,result(:,(i-1)*8+colnummod+7)-result(:,3),'g','linestyle',lstyle{i});
    end;
    % non-parametric intervals
    if get(obj1(2),'value')
        figure(3)
        plot(([1;1]*(1:N))',result(:,(i-1)*8+colnummod+[8,9]),'k','linestyle',lstyle{i});
        figure(4)
        plot(1:N,result(:,(i-1)*8+colnummod+8)-result(:,3),'k',...
            1:N,result(:,(i-1)*8+colnummod+9)-result(:,3),'k','linestyle',lstyle{i});
    end;
end;

figure(3)
hold off
set(gca,'xlim',[0,N+1]);
legend('Actual price', 'Price forecast')
ylabel('Price [USD/MWh]')
xlabel('Hours')

figure(4)
hold off
set(gca,'xlim',[0,N+1]);
legend('Actual price', 'Price forecast')
ylabel('Price deviation [USD/MWh]')
xlabel('Hours')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -