Yesterday is history, tomorrow is a mystery, but today is gift. That's why we called it the present. >>>>>>> 点此联系我

Matlab 多通道信号绘制

clear;

load('FormatData_setA_998.mat', 'X', 'Y');
% X: 5000x12x998 double
% Y: 998x1 double

% multiChFig = figure;
selIdx = 3;

plotMap = X(:,:,selIdx);
opt.numStd = 8;
opt.CONSTANT = 10;
opt.zoomMode = 1;   % 0: use a CONSTANT as zoom coefficient
                % 1: use STD*n as zoom coefficient 
                % 2: use STD(channel)*n as zoom coefficient 

plotMultiChannelSignal(plotMap, opt);

%% Support Function
function plotMap = plotMultiChannelSignal(plotMap, opt)
numStd = opt.numStd;
CONSTANT = opt.CONSTANT;
zoomMode = opt.zoomMode;
numCh = size(plotMap,2);

if zoomMode == 0
    const = CONSTANT;
    plotMap = plotMap + repmat([1:numCh].*const,[size(plotMap,1) 1]);
    ylimMax = (numCh+1)*const;
elseif zoomMode == 1
    stdAllMap = std(plotMap,[],'all');
    const = numStd*stdAllMap;
    plotMap = plotMap + repmat([1:numCh].*const,[size(plotMap,1) 1]);
    ylimMax = (numCh+1)*const;
elseif zoomMode == 2
    stdMap = std(plotMap,[],1);
    const = numStd*stdMap;
    plotMap = plotMap + repmat([1:numCh].*const,[size(plotMap,1) 1]);
    ylimMax = (numCh+1)*const(end);
else
    error('No Such Option');
end

% plotMap = plotMap + repmat([1:numCh].*numStd*stdAllMap,[size(plotMap,1) 1]);
% figure(multiChFig);
figure;
plot(plotMap, 'k');
xlim([0 size(plotMap,1)]);
ylim([0 ylimMax]);
ylabel('Channels');
xlabel('Points');
% yticklabels(num2cell(1:numCh));
yticklabels('');
% title([cnnType ' Layer ' num2str(iLayer)]);

end

  

posted @ 2020-09-09 00:05  virter  阅读(1029)  评论(0编辑  收藏  举报