先看效果:用绿色矩形标示出 150ms 到 350ms 之间的区域
操作,使用 patch 函数即可
limy = 3;
v2 = [0.15 -limy; 0.35 -limy; 0.35 limy; 0.15 limy];
f2 = [1 2 3 4];
patch('Faces',f2,'Vertices',v2,'FaceColor','green','FaceAlpha',.3,'EdgeColor','none');
此外还能用面积填充图作为标记,比如这里用两个颜色说明横轴上下的面积
使用 area 函数即可
areadata = rbdata(1,1:241);
id1 = find(areadata>=0);
areadata1 = areadata;
areadata1(id1) = 0;
area(-0.2:1/1200:0,areadata1,'facecolor',[0.75,0.75,0],'edgecolor','none');
hold on
id2 = find(areadata<=0);
areadata2 = areadata;
areadata2(id2) = 0;
area(-0.2:1/1200:0,areadata2,'facecolor',[0,0.75,0.75],'edgecolor','none');
hold on