Home > eeg > egis > scripts > plot_egis_data.m

plot_egis_data

PURPOSE ^

SYNOPSIS ^

function status = plot_egis_data(cell,obs,chans,freqs,Samp_Rate,LoPass);

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function status = plot_egis_data(cell,obs,chans,freqs,Samp_Rate,LoPass);
0002 
0003 
0004 if (nargin < 2);
0005     error('cells and observations not specified')
0006 end;
0007 
0008 
0009 if (nargin < 3);
0010     chans = [9 11 23 25 34 37 46 58 60 62 71 84 86 97 105 109 122 124 129];
0011 end;
0012 if chans == []
0013     chans = [9 11 23 25 34 37 46 58 60 62 71 84 86 97 105 109 122 124 129];
0014 end
0015 if nargin < 4
0016     freqs = [];
0017 end
0018 
0019 open_header_utility;
0020 ref_trialdata = read_trial_utility(fid,Cell_DataOffset(cell),obs,NChan,Npoints(cells));
0021 max_trialdata = max(max(abs(ref_trialdata(:,chans))));
0022 max_trialdata = max_trialdata*1.1;
0023 if nargin == 6
0024     [b,a] = butter(20,[LoPass/(Samp_Rate/2)]);
0025     for i = 1:size(chans,2)
0026         ref_trialdata = filtfilt(b,a,ref_trialdata(:,chans(i)));
0027     end;
0028 end;
0029 time = [1:size(ref_trialdata,1)];
0030 figure
0031 for i = 1:size(chans,2)
0032     hold on,plot(time,ref_trialdata(:,chans(i))+(i-1)*max_trialdata*ones(size(ref_trialdata,1),1),'w-')
0033     hold on, plot([min(time)-0.25 max(time)+0.25],[(i-1)*max_trialdata (i-1)*max_trialdata],'w--')
0034     hold on, text(max(time)+0.4,(i-1)*max_trialdata,int2str(chans(i)));
0035 end
0036 xlabel('Time (samples)')
0037 ylabel('Bins')
0038 if nargin > 3
0039     if freqs ~= []
0040         figure
0041         fft_trial = abs(fft(ref_trialdata(:,chans)));
0042         max_fft = max(max(fft_trial));
0043         frequency = [0:fix(size(fft_trial,1)/2)-1]/size(seconds,2);
0044         for i = 1:size(chans,2)
0045             hold on,plot(frequency,fft_trial(1:size(frequency,2),i)+(i-1)*max_fft*ones(size(frequency,2),1),'w-')
0046             hold on,axis([freqs(1) freqs(2) 0 size(chans,2)*max_fft ])
0047             hold on, plot([min(freqs)-1 max(freqs)*1.1],[(i-1)*max_fft (i-1)*max_fft],'w--')
0048             hold on, text(max(freqs)*0.75,(i-0.5)*max_fft,int2str(chans(i)));
0049             
0050         end
0051     end    
0052 end    
0053     
0054 
0055

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003