Home > vbmeg > demo > test_scripts > vb_test_berg.m

vb_test_berg

PURPOSE ^

test berg

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 test berg

 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 % test berg
0002 %
0003 % Copyright (C) 2011, ATR All Rights Reserved.
0004 % License : New BSD License(see VBMEG_LICENSE.txt)
0005 
0006 RootDir = [getenv('MFILE') ]; 
0007 addpath([RootDir '/MEGdata/meg/EEG/']);
0008 
0009 % File name for save data
0010 fname = 'test';
0011 
0012 % Nopt : # of optimization search
0013 % Nmax : # of Legendre Expansion
0014 %  NJ  : Number of Berg Dipoles
0015 Nopt = 2000;
0016 Nmax = 200;  
0017 NJ   = 5;       
0018 
0019 % R    : Radii of sphere from innermost to outermost
0020 % sigma: Conductivity    from innermost to outermost
0021 R     = [ 0.87  0.92   1.0 ];
0022 sigma = [ 1.0  0.0125  1.0 ];
0023 
0024 % Zhang value
0025 % mu =   0.4421    0.7687    0.9901
0026 % lam =  0.3561    0.2389    0.0659
0027 
0028 %R     = [ 0.84  0.8667  0.9467  1.0 ];
0029 %sigma = [ 1.0   3.0     0.0125  1.0 ];
0030 %
0031 % mu  =  0.7412    0.4128    0.9769
0032 % lam =  0.2239    0.3345    0.0495
0033 
0034 % Define test current
0035 Ndipole = 1000;    % = [];
0036 
0037 % Parameter setting
0038 vb_set_current_V;
0039 
0040 % Profile mode setting
0041 profile_on = 0;
0042 
0043 if profile_on > 0,
0044     profile on -detail builtin
0045 else
0046     tic
0047 end;
0048 
0049 eeg = vb_eeg_multi_shell(V, xx, pick, R, sigma, NJ);
0050 
0051 %[mu, lam] = vb_berg_param(R, sigma, NJ, Nmax, Nopt);
0052 
0053 Nmax = 200;
0054 
0055 GG   = vb_eeg_legendre(V,xx,pick,R,sigma,Nmax);
0056 
0057 %method = 1;
0058 % = 1 : Legendre expansion
0059 % = 2 : Berg method
0060 %
0061 %G   = eeg_multi_sphere(V, pick, R,sigma,Nmax,method,mu,lam);
0062 %G   = eeg_multi_sphere(V, pick, R, sigma);
0063 
0064 if profile_on==1,
0065     profile report profile_job
0066 elseif profile_on==2,
0067     profile viewer
0068 else
0069     vb_ptime(toc)
0070 end
0071 
0072 %return
0073 %   G    : EEG forward model gain matrix      M x (3*P)
0074 
0075 %G   = reshape(G, Nsensor, 3, NV);
0076 %GG  = zeros(NV,Nsensor);
0077 %
0078 %for n=1:Nsensor
0079 %    GG(:,n)  = sum( squeeze(G(n,:,:))'.*xx, 2);
0080 %end
0081 
0082 
0083 err = sum(sum( abs(GG - eeg) ))./sum(sum(abs(GG)))
0084 
0085 vb_fsave(fname,'GG','eeg');
0086 
0087 return
0088 
0089 ed = GG(:,1) - eeg(:,1);
0090 plot(GG(:,1));
0091 hold on
0092 plot(ed,'r-');
0093 
0094 plot(eeg(:,1));
0095 hold on
0096 plot(eeg(:,1)-G(1,:)', '-r');
0097 
0098 fval
0099 nsteps
0100 
0101 
0102 %G   = eeg_single_shell(V, pick, sigma0);
0103 %
0104 %eeg = zeros(NV,Nsensor);
0105 %
0106 %for n=1:Nsensor
0107 %    eeg(:,n) = vb_eeg_one_shell(V, xx, pick(n,:), sigma0);
0108 %end
0109 %
0110 %eeg = zeros(NV,3,Nsensor);
0111 %
0112 %for n=1:Nsensor
0113 %    eeg(:,:,n) = vb_eeg_one_shell2(V, pick(n,:), sigma0);
0114 %end

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