Home > eeg > egis > petr_dirtier > average_interp.m

average_interp

PURPOSE ^

average_interp.m

SYNOPSIS ^

function [avgimg] = average_interp(interp_data,plot_res,samps2average)

DESCRIPTION ^

 average_interp.m

 interp_data can either be a plot_res X (plot_resXnsamps) image, or a plot_res
 X plot_res X nsamps image

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [avgimg] = average_interp(interp_data,plot_res,samps2average)
0002 % average_interp.m
0003 %
0004 % interp_data can either be a plot_res X (plot_resXnsamps) image, or a plot_res
0005 % X plot_res X nsamps image
0006 %
0007 
0008 % 06/13/00  PJ  Modified to accomodate interp_data of various sizes
0009 
0010 dims = size(interp_data);
0011 ndim = length(dims);
0012 
0013 if ndim == 3
0014   if (dims(1) ~= dims(2)) & (dims(1) ~= plot_res)
0015     error('Do not understand dimensionality: %s', sprintf('%d ', dims))
0016   end
0017 end
0018 
0019 navg = length(samps2average);
0020 
0021 avgimg = 0;
0022 
0023 if ndim == 2
0024   for isamp = 1:navg
0025     avgimg = avgimg + ...
0026     interp_data(:,(samps2average(isamp)-1)*plot_res+1:samps2average(isamp)*plot_res);
0027   end
0028   avgimg = avgimg/navg;
0029 else
0030   avgimg = mean(interp_data(:,:,samps2average),3);
0031 end
0032 
0033 return

Generated on Sun 24-Mar-2019 04:00:51 by m2html © 2003