1+ function h = comodulogramt(freqs_phase ,freqs_amp ,timevect , pacval , varargin )
2+
3+ icadefs ;
4+ h = [];
5+ if nargin < 4
6+ help comodulogramt ;
7+ return ;
8+ end
9+
10+ DefaultTitle = ' Modulation Index' ;
11+ ZLabelDefault = ' Phase Frequency (Hz)' ;
12+ YLabelDefault = ' Amplitude Frequency (Hz)' ;
13+ XLabelDefault = ' Latency(sec)' ;
14+ CBarLabelDefault = ' Modulation Index' ;
15+ g = finputcheck( varargin , { ...
16+ ' npoints' ' integer' [2 length(timevect ) ] 20 ;
17+ ' times' ' integer' [] [];
18+ ' title' ' string' ' ' DefaultTitle ;
19+ ' zlabel' ' string' ' ' ZLabelDefault ;
20+ ' ylabel' ' string' ' ' YLabelDefault ;
21+ ' xlabel' ' string' ' ' XLabelDefault ;
22+ ' cbartext' ' string' ' ' CBarLabelDefault ;
23+ ' comodtazimuth' ' integer' [] - 10 ;
24+ ' comodtelevation' ' integer' [] 23 ;
25+ ' facealpha' ' integer' [] 0.5 ;
26+ ' scale' ' string' {' linear' ' log' } ' log' });
27+ % Determining nearest time
28+ if isempty(g .times )
29+ times = min(timevect ): ((max(timevect )-min(timevect ))/(g .npoints - 1 )): max(timevect );
30+ else
31+ times = g .times ;
32+ end
33+ [~ , timeidx ] = min(abs(repmat(timevect ,length(times ),1 )-repmat(times ' ,1 ,length(timevect ))),' ' ,2 );
34+ tplot = timevect(timeidx );
35+
36+ %% Plotting start here
37+
38+ h = figure(' Name' , g .title ,' Units' ,' Normalized' ,' Position' , [0.2349 0.3093 0.5547 0.2907 ],' Tag' ,' comodt_plot' );
39+ haxes = axes(' Units' , ' Normalized' ,' Color' ,' None' ,' parent' , h );
40+
41+ % Plot
42+ Z = pacval(: ,: ,timeidx );
43+ [M ,N ,P ] = size(Z );
44+ for i= 1 : P
45+ % Create a plane at x=i
46+ hsurf = surface(tplot(i )*ones(1 ,M ),1 : N ,repmat([M : -1 : 1 ],N ,1 ),repmat([M : -1 : 1 ],N ,1 ));
47+ % set the color of the plane to be the image
48+ set(hsurf ,' CData' , flipud(Z(: ,: ,i ))' );
49+ % set some extra properties
50+ set(hsurf ,' EdgeColor' ,' none' );
51+ alpha(g .facealpha )
52+ end
53+
54+ % Makeup
55+ % set the viewing angle
56+ view(g .comodtazimuth , g .comodtelevation )
57+ axis tight ; grid on ;
58+ h_ylabel = ylabel(g .ylabel ,' FontSize' ,AXES_FONTSIZE_L ,' FontWeight' ,' bold' ,' Units' ,' Normalized' );
59+ h_zlabel = zlabel(g .zlabel ,' FontSize' ,AXES_FONTSIZE_L ,' FontWeight' ,' bold' ,' Units' ,' Normalized' );
60+ h_xlabel = xlabel(g .xlabel ,' FontSize' ,AXES_FONTSIZE_L ,' FontWeight' ,' bold' ,' Units' ,' Normalized' );
61+
62+ set(haxes ,' Color' ,' None' );
63+
64+ % Y axis labels
65+ ylabel_val = freqs_amp(get(haxes ,' YTick' ));
66+ for i = 1 : length(ylabel_val )
67+ ylabel_string{i } = sprintf(' %1.1f ' ,ylabel_val(i ));
68+ end
69+ set(haxes ,' YTickLabel' , ylabel_string ,' FontSize' ,AXES_FONTSIZE_L );
70+
71+ % Z axis label
72+ zlabel_val = freqs_phase(get(haxes ,' ZTick' ));
73+ for i = 1 : length(zlabel_val )
74+ zlabel_string{i } = sprintf(' %1.1f ' ,zlabel_val(i ));
75+ end
76+ set(haxes ,' ZTickLabel' , zlabel_string );
77+
78+ % X axis label
79+ set(haxes ,' XTick' , tplot );
80+ for i = 1 : length(tplot )
81+ xlabel_string{i } = sprintf(' %1.2f ' ,tplot(i ));
82+ end
83+ set(haxes ,' XTickLabel' , xlabel_string );
84+
85+ % Title
86+ title(g .title ,' FontSize' ,AXES_FONTSIZE_L ,' FontWeight' ,' bold' );
87+
88+ % colorbar
89+ hbar = colorbar ;
90+ set(get(hbar ,' Label' ),' String' ,g .cbartext );
91+ end
92+
0 commit comments