Home > vbmeg > functions > device > active_check > vb_get_max_std_ratio.m

vb_get_max_std_ratio

PURPOSE ^

Estimate mean amplitude by using histgram for outlier exclusion

SYNOPSIS ^

function [ymax, ystd] = vb_get_max_std_ratio(data)

DESCRIPTION ^

 Estimate mean amplitude by using histgram for outlier exclusion
 and calculate amplitude/mean ratio to find bad channel & trials
 amplitude/mean ratio using Median can be also calculated
   [xmax, xstd] = vb_get_max_std_ratio(X)
 X(t,n) : signal at time t & n-th trial
 xstd   : mean amplitude excluding outlier
 xmax(n): max amplitude for each trial
        = max_t (abs(X(t,n))) 
 
 2009-08-10 Masa-aki Sato

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [ymax, ystd] = vb_get_max_std_ratio(data)
0002 % Estimate mean amplitude by using histgram for outlier exclusion
0003 % and calculate amplitude/mean ratio to find bad channel & trials
0004 % amplitude/mean ratio using Median can be also calculated
0005 %   [xmax, xstd] = vb_get_max_std_ratio(X)
0006 % X(t,n) : signal at time t & n-th trial
0007 % xstd   : mean amplitude excluding outlier
0008 % xmax(n): max amplitude for each trial
0009 %        = max_t (abs(X(t,n)))
0010 %
0011 % 2009-08-10 Masa-aki Sato
0012 %
0013 % Copyright (C) 2011, ATR All Rights Reserved.
0014 % License : New BSD License(see VBMEG_LICENSE.txt)
0015 
0016 [T, Ntry] = size(data);
0017 
0018 pmin = 0.05;
0019 pmax = 1 - pmin;
0020 
0021 yamp = abs(data);
0022 % Max of each trial
0023 ymax = max(yamp,[],1); % [1 x Ntry]
0024 
0025 % exclude outlier
0026 y = sort(yamp(:));
0027 y = y(1:fix(T*Ntry*pmax));
0028 
0029 ystd = sqrt(mean(y.^2));
0030 
0031 %% Histgram
0032 % Nbin = 200;
0033 % [h , y] = hist(yamp(:),Nbin);
0034 %% probability dencity
0035 % p = h/sum(h);
0036 %% cumurative probability
0037 % psum = cumsum(p);
0038 %% limit the range of mean calculation (exclude outlier)
0039 % imax = find(psum > pmax, 1);
0040 % jx = find(yamp(:) <= y(imax));
0041 % ystd = sqrt(mean(yamp(jx).^2));
0042 %
0043 
0044 return
0045 %%% END %%%

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005