Repository navigation
Expand file tree
/
Copy pathplot_modep.m
More file actions
47 lines (41 loc) · 1.76 KB
/
Copy pathplot_modep.m
File metadata and controls
47 lines (41 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function [ output_args ] = plot_modep( fc, fmc, Emod, varargin )
%PLOT_MODEP plot the excitation pattern of the output of the excitation
%model
% Use as plot_modep(fc, fmc, Emod, time_EP, decision_statistics) with:
% - fc a vector of Nchannels frequency values (spectral filterbank)
% - fmc a vector of Nmodchannels modulation values (modulation
% filterbank)
% - Emod a Nsamples X Nchannels X Nmodchannels matrix
% - time_EP the time samples to be considered in the calculation of the
% excitation pattern (default: all)
% - decision_statistics the function calculating the statistics to be
% represented (default: @(x) mean(x.^2,3))
%
% Leo Varnet 2016
Nsamples = size(Emod,1);
Nchannels = size(Emod,2);
Nmodchannels = size(Emod,3);
if length(fc)~=Nchannels
error('fc must be the same size as the first dimension of Emod')
end
if length(fmc)~=Nmodchannels
error('fc must be the same size as the second dimension of Emod')
end
% defaults
time_EP = 1:Nsamples;
decision_statistics_fun = @(x) mean(x.^2,1);
if length(varargin)>=2 & ~isempty(varargin{2})
decision_statistics_fun = varargin{2};
end
if length(varargin)>=1 & ~isempty(varargin{1})
time_EP = varargin{1};
end
excitation_pattern = squeeze(decision_statistics_fun(Emod(time_EP,:,:)));
figure; imagesc(excitation_pattern');
set(gca,'YDir','normal','XTick', 1:5:Nchannels, 'YTick', 1:Nmodchannels, 'XTickLabels', num2str(floor(fc(1:5:Nchannels)')), 'YTickLabels', num2str(floor(fmc(1:Nmodchannels)')))
%set(h,'EdgeColor','none');
%set(gca,'XScale','log'); set(gca,'YScale','log');%view(2);
%xlim([fc(1) fc(end)]); ylim([fmc(1) fmc(end)]);
xlabel('center frequency (Hz)'); ylabel('modulation frequency (Hz)');
title('modulation excitation pattern');
end