Home > eeg > egis > phantom > fender_4.m

# fender_4

## PURPOSE

[a,b,c,d,e,f,g] = fender_4(nmax,s12,s13,r1,r2,r3,r4,rz)

## SYNOPSIS

function [a,b,c,d,e,f,g] = fender_4(nmax,s12,s13,r1,r2,r3,r4,rz)

## DESCRIPTION

``` [a,b,c,d,e,f,g] = fender_4(nmax,s12,s13,r1,r2,r3,r4,rz)
nmax = maximum n to calculate (a-g are sized to(1, nmax)
s12 = conductivity brain/CSF
s13 = conductivity brain/skull

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:
• transfer_matrix [potmat,lapmat,cortmat] = transfer_matrix(nmax,s12,s13,r1,r2,r3,r4,rz,sources,electrodes);
• transfer_plot [h,a,l] = transfer_plot(nmax,s12,s13,r1,r2,r3,r4,rz)

## SOURCE CODE

```0001 function [a,b,c,d,e,f,g] = fender_4(nmax,s12,s13,r1,r2,r3,r4,rz)
0002 % [a,b,c,d,e,f,g] = fender_4(nmax,s12,s13,r1,r2,r3,r4,rz)
0003 % nmax = maximum n to calculate (a-g are sized to(1, nmax)
0004 % s12 = conductivity brain/CSF
0005 % s13 = conductivity brain/skull
0006 % r1 = radii brain
0007 % r2 = radii CSF
0008 % r3 = radii skull
0009 % r4 = radii scalp
0010 % rz = radii source
0011 a = zeros(1,nmax);
0012 b = zeros(1,nmax);
0013 c = zeros(1,nmax);
0014 d = zeros(1,nmax);
0015 e = zeros(1,nmax);
0016 f = zeros(1,nmax);
0017 g = zeros(1,nmax);
0018
0019 q = 1./4/pi/r1^2;
0020
0021 s34 = 1/s13;
0022
0023 s23 = s13/s12;
0024
0025 r12 = r1/r2;
0026
0027 r21 = r2/r1;
0028
0029 r23 = r2/r3;
0030
0031 r32 = r3/r2;
0032
0033 r43 = r4/r3;
0034
0035 r34 = r3/r4;
0036
0037 rz1 = rz/r1;
0038
0039 for n = 1:nmax
0040 xn = n;
0041 np = (n+1)/n;
0042
0043 vnfac = (r34^n - r43^(n+1))/(np*r34^n+r43^(n+1));
0044 vn = (s34/np-vnfac)/(s34+vnfac);
0045 wn = ((r23^n)/np - vn*r32^(n+1))/((r23^n)+vn*r32^(n+1));
0046 yn = (s23/np-wn)/(s23+wn);
0047 zn = (r12^n-np*yn*r21^(n+1))/(yn*r21^(n+1)+r12^n);
0048 a(n) = q*((rz1^(n-1))*(n*zn+s12*(n+1)))/(s12-zn);
0049 b(n) = (a(n)+xn*q*(rz1^(n-1)))/(yn*(r21^(n+1))+r12^n);
0050 c(n) = yn*b(n);
0051 d(n) = (b(n)+c(n))/(r23^n+vn*(r32^(n+1)));
0052 e(n) = vn*d(n);
0053 g(n) = (d(n)+e(n))/(np*r34^n+r43^(n+1));
0054 f(n) = np*g(n);
0055 end;```

Generated on Sun 25-Aug-2019 04:00:39 by m2html © 2003