多边形填充图(`fill`)

多边形填充图(fill)

01_二维线图 5 张 MATLAB R2023b 100 mm 宽 @ 300 dpi

这个方法适合什么

任意多边形填充,可叠出区间带。适合:电压允许偏差带、预测置信区间、保护动作区、安全运行边界。

电气场景

1 母线电压允许区间

2 负荷预测置信区间

3 光伏出力波动区间

4 系统频率允许范围

5 谐波电压包络

代码

脚本 p1_line_plots.m 中对应 fill 的一段,SEL 用于选择只跑某几个方法。

if any(SEL==8)
    % ---- 8.1 母线电压允许偏差带 ----
    t  = 0:0.5:24;
    lo = 9.30*ones(size(t)); hi = 10.70*ones(size(t));
    u  = 10.02 + 0.10*sin(2*pi*t/24+0.6) + 0.03*sin(2*pi*t/7);
    f  = ml_fig(PP,100,80);
    ax = axes('Parent',f,'Position',[0.175 0.190 0.770 0.755]);
    p  = fill(ax,[t fliplr(t)],[lo fliplr(hi)],[0.85 0.90 0.95], ...
              'EdgeColor',[0.55 0.62 0.70],'LineWidth',0.6); hold(ax,'on');
    h1 = plot(ax,t,u,'Color',C(4,:),'LineWidth',1.2);
    xlabel(ml_tx('时刻 <i>t</i> / h'));
    ylabel(ml_tx('母线电压 <i>U</i> / kV'));
    xlim(ax,[0 24]); ylim(ax,[9.15 11.34]);
    lg = legend(ax,[p h1],ml_tx({'±7% 允许区间','实测电压'}),'Location','northeast');
    ml_style_legend(lg,PP);
    save_png(f,FIGD,'母线电压允许区间');

    % ---- 8.2 负荷预测置信区间 ----
    t  = 1:24;
    m  = 18 + 4.5*exp(-((t-10)/3.2).^2) + 3.2*exp(-((t-19)/3.0).^2);
    up = m + 2.6; dn = m - 2.6;
    f  = ml_fig(PP,100,80);
    ax = axes('Parent',f,'Position',[0.175 0.190 0.770 0.755]);
    p  = fill(ax,[t fliplr(t)],[dn fliplr(up)],[0.88 0.93 0.85], ...
              'EdgeColor',[0.58 0.66 0.52],'LineWidth',0.6); hold(ax,'on');
    h1 = plot(ax,t,m,'Color',C(3,:),'LineWidth',1.2);
    xlabel(ml_tx('时刻 <i>t</i> / h'));
    ylabel(ml_tx('负荷 <i>P</i> / MW'));
    xlim(ax,[1 24]); ylim(ax,[12 32]);
    lg = legend(ax,[p h1],ml_tx({'90% 置信区间','预测均值'}),'Location','northeast');
    ml_style_legend(lg,PP);
    save_png(f,FIGD,'负荷预测置信区间');

    % ---- 8.3 光伏出力波动区间 ----
    t  = 5:0.25:19;
    m  = 8.2*sin(pi*(t-5)/14);
    up = m*1.18 + 0.15; dn = max(m*0.80 - 0.15,0);
    f  = ml_fig(PP,100,80);
    ax = axes('Parent',f,'Position',[0.175 0.190 0.770 0.755]);
    p  = fill(ax,[t fliplr(t)],[dn fliplr(up)],[1.00 0.94 0.78], ...
              'EdgeColor',[0.75 0.62 0.35],'LineWidth',0.6); hold(ax,'on');
    h1 = plot(ax,t,m,'Color',C(2,:),'LineWidth',1.2);
    xlabel(ml_tx('时刻 <i>t</i> / h'));
    ylabel(ml_tx('有功出力 <i>P</i> / MW'));
    xlim(ax,[5 19]); ylim(ax,[0 13.2]);
    lg = legend(ax,[p h1],ml_tx({'波动区间','预测出力'}),'Location','northeast');
    ml_style_legend(lg,PP);
    save_png(f,FIGD,'光伏出力波动区间');

    % ---- 8.4 系统频率允许范围 ----
    t  = 0:0.1:60;
    lo = 49.80*ones(size(t)); hi = 50.20*ones(size(t));
    fr = 50 + 0.10*sin(2*pi*t/17) + 0.05*sin(2*pi*t/4.3);
    f  = ml_fig(PP,100,80);
    ax = axes('Parent',f,'Position',[0.175 0.190 0.770 0.755]);
    p  = fill(ax,[t fliplr(t)],[lo fliplr(hi)],[0.86 0.92 0.94], ...
              'EdgeColor',[0.52 0.64 0.68],'LineWidth',0.6); hold(ax,'on');
    h1 = plot(ax,t,fr,'Color',C(4,:),'LineWidth',1.1);
    xlabel(ml_tx('时间 <i>t</i> / min'));
    ylabel(ml_tx('系统频率 <i>f</i> / Hz'));
    xlim(ax,[0 60]); ylim(ax,[49.55 50.88]);
    lg = legend(ax,[p h1],ml_tx({'±0.2 Hz 允许范围','实测频率'}),'Location','northeast');
    ml_style_legend(lg,PP);
    save_png(f,FIGD,'系统频率允许范围');

    % ---- 8.5 谐波电压含有率包络 ----
    hh = 2:2:25;
    lo = 0.9./hh.^0.9;
    hi = 3.6./hh.^0.9;
    lim = 4.0./hh.^0.75;
    f  = ml_fig(PP,100,80);
    ax = axes('Parent',f,'Position',[0.175 0.190 0.770 0.755]);
    p  = fill(ax,[hh fliplr(hh)],[lo fliplr(hi)],[0.90 0.88 0.95], ...
              'EdgeColor',[0.62 0.56 0.78],'LineWidth',0.6); hold(ax,'on');
    h1 = plot(ax,hh,lim,'Color',C(4,:),'LineWidth',1.3,'LineStyle','--');
    xlabel(ml_tx('谐波次数 <i>h</i>'));
    ylabel(ml_tx('电压含有率 / %'));
    xlim(ax,[1.5 25.5]); ylim(ax,[0 4.6]);
    lg = legend(ax,[p h1],ml_tx({'7 日实测包络','国标限值'}),'Location','northeast');
    ml_style_legend(lg,PP);
    save_png(f,FIGD,'谐波电压包络');
end
posted @ 2026-11-09 00:03  小青蛙电气  阅读(2)  评论(0)    收藏  举报