rmeddis@38
|
1 function plotIFRAN(data_matrix,start_time,end_time,sfreq,BFlist,plothandle)
|
rmeddis@38
|
2
|
rmeddis@38
|
3 %function that produces a plot similar to the plots in Secker-Walker, JASA
|
rmeddis@38
|
4 %1990 Fig.2 (Neurograms) from a IFRAN data matrix
|
rmeddis@38
|
5 %Tim Jürgens, January 2011
|
rmeddis@38
|
6
|
rmeddis@38
|
7 %plot 50ms right from the middle of the signal
|
rmeddis@38
|
8 time_axis = [0:1/sfreq:(size(data_matrix,2)-1)/sfreq];
|
rmeddis@38
|
9 %start_time = size(data_matrix,2)/2/sfreq-0.025; %start time to plot in s
|
rmeddis@38
|
10 %temporal_length = min([0.05 size(data_matrix,2)/sfreq]); %length to plot in s, at least 50ms or the length of the stimulus
|
rmeddis@38
|
11 [tmp, start_time_index] = min(abs(start_time-time_axis));
|
rmeddis@38
|
12 %end_time = start_time+temporal_length;
|
rmeddis@38
|
13 [tmp, end_time_index] = min(abs(end_time-time_axis));
|
rmeddis@38
|
14
|
rmeddis@38
|
15
|
rmeddis@38
|
16 %smoothing using a 4-point hamming window
|
rmeddis@38
|
17 hamm_window = hamming(4);
|
rmeddis@38
|
18 for iCounter = 1:size(data_matrix,1)
|
rmeddis@38
|
19 for jCounter = 2:length(time_axis)-2 %start with 2 and end with 2 samples
|
rmeddis@38
|
20 %less the length of time_axis in order not to get in conflict with the length of
|
rmeddis@38
|
21 %the hamm_window
|
rmeddis@38
|
22 smoothed_data_matrix(iCounter,jCounter-1) = ...
|
rmeddis@38
|
23 data_matrix(iCounter,(jCounter-1):(jCounter+2))*hamm_window./sum(hamm_window);
|
rmeddis@38
|
24 end
|
rmeddis@38
|
25 end
|
rmeddis@38
|
26
|
rmeddis@38
|
27 smoothed_time_axis = time_axis(2:end-2);
|
rmeddis@38
|
28
|
rmeddis@38
|
29 if ~exist('plothandle'), plothandle=figure; end
|
rmeddis@38
|
30
|
rmeddis@38
|
31 verticalshift = 1000; %vertical shift of single time series in z-coordinate units
|
rmeddis@38
|
32 Tickvector = [];
|
rmeddis@38
|
33 TickLabels = [];
|
rmeddis@38
|
34 for iCounter = 1:size(data_matrix,1)
|
rmeddis@38
|
35 set(gcf,'Currentaxes',plothandle);
|
rmeddis@38
|
36
|
rmeddis@38
|
37 %multiply by 1000 to set abscissa to ms units
|
rmeddis@38
|
38 verticalposition = -verticalshift*(iCounter-1);
|
rmeddis@38
|
39 plot(1000.*smoothed_time_axis(start_time_index:end_time_index), ...
|
rmeddis@38
|
40 smoothed_data_matrix(size(data_matrix,1)-iCounter+1,start_time_index:end_time_index)+verticalposition, ...
|
rmeddis@38
|
41 'k','LineWidth',0.5);
|
rmeddis@38
|
42 xlim([1000*start_time 1000*end_time]);
|
rmeddis@38
|
43 if mod(iCounter,5) == 1 %set best frequency as a label every 5 channels
|
rmeddis@38
|
44 Tickvector = [Tickvector verticalposition];
|
rmeddis@38
|
45 TickLabels = [TickLabels; BFlist(size(data_matrix,1)-iCounter+1)];
|
rmeddis@38
|
46 end
|
rmeddis@38
|
47 hold on;
|
rmeddis@38
|
48 end
|
rmeddis@38
|
49 set(gca,'yTick',Tickvector(end:-1:1),'yTickLabel',num2str(TickLabels(end:-1:1),'%4.0f'));
|
rmeddis@38
|
50 ylabel('Best Frequency of Filter (Hz)');
|
rmeddis@38
|
51 xlabel('Stimulus Time (ms)');
|
rmeddis@38
|
52 set(gca,'YLim',[-(size(data_matrix,1))*verticalshift verticalshift*1.5]);
|
rmeddis@38
|
53 box on;
|
rmeddis@38
|
54 hold off; |