ForwardSolution

PURPOSE ^

ForwardSolution Solves the potential distribution in 2D EIT

SYNOPSIS ^

function [U,p,r]=ForwardSolution(NNode,NElement,A,C,T,MeasPattern,style,p,r);

DESCRIPTION ^

ForwardSolution Solves the potential distribution in 2D EIT 
 Function [U,p,r]=ForwardSolution(NNode,NElement,A,C,T,MeasPattern,style,p,r);
 computes the internal voltages for the injected currents (U.Current)
 and for the "measurement field" (U.MeasField) and the voltages
 on the electrodes (U.Electrode).

 INPUT

 NNode = the number of nodes
 NElement = the number of elements
 A = the system matrix
 C = the reference matrix
 T = current patterns
 MeasPattern = measurement pattern, default \sum_{l=1}^L=0.
 style = 'comp' for complex reconstruction and 'real' for real
 p = the permutation vector (optional)
 r = reversed permutation   (optional)

 OUTPUT

 U = potential data structure, includes potetial correspondign to the actual
     current injections (U.Current), for the measurement pattern (U.MeasField)
     and voltages on the electrodes (U.Electrode)
 p = the permutation vector (optional)
 r = reversed permutation   (optional)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [U,p,r]=ForwardSolution(NNode,NElement,A,C,T,MeasPattern,style,p,r);
0002 
0003 %ForwardSolution Solves the potential distribution in 2D EIT
0004 % Function [U,p,r]=ForwardSolution(NNode,NElement,A,C,T,MeasPattern,style,p,r);
0005 % computes the internal voltages for the injected currents (U.Current)
0006 % and for the "measurement field" (U.MeasField) and the voltages
0007 % on the electrodes (U.Electrode).
0008 %
0009 % INPUT
0010 %
0011 % NNode = the number of nodes
0012 % NElement = the number of elements
0013 % A = the system matrix
0014 % C = the reference matrix
0015 % T = current patterns
0016 % MeasPattern = measurement pattern, default \sum_{l=1}^L=0.
0017 % style = 'comp' for complex reconstruction and 'real' for real
0018 % p = the permutation vector (optional)
0019 % r = reversed permutation   (optional)
0020 %
0021 % OUTPUT
0022 %
0023 % U = potential data structure, includes potetial correspondign to the actual
0024 %     current injections (U.Current), for the measurement pattern (U.MeasField)
0025 %     and voltages on the electrodes (U.Electrode)
0026 % p = the permutation vector (optional)
0027 % r = reversed permutation   (optional)
0028          
0029 % M. Vauhkonen 13.8.1999
0030 % University of Kuopio, Department of Applied Physics,
0031 % PO Box 1627, FIN-70211, Kuopio, Finland, email:Marko.Vauhkonen@uku.fi
0032 % Ordering added 15.11.1999, modified 28.3.2000 by M. Vauhkonen
0033 
0034 L=max(size(A))-NNode+1;    % The number of electrodes
0035 
0036 if style=='comp'                    
0037  II1=sparse([zeros(L,NNode),C,zeros(L,NNode+L-1);zeros(L,2*NNode+L-1),C]);
0038   if ~isempty(MeasPattern) 
0039    II1=MeasPattern'*II1;
0040    II1=II1'; 
0041   else
0042    MeasPattern=eye(2*max(size(C)));
0043    II1=II1';
0044   end
0045  II=sparse([[zeros(NNode,size(T,2));C'*T];zeros(NNode+L-1,size(T,2))]);
0046  A=[real(A),-imag(A);imag(A),real(A)];
0047  UU=A'\II1;%Voltages for the "measurement field" and for the current patterns.
0048  UU=full([UU,A\II]);
0049  U.MeasField=[UU(1:NNode,1:size(II1,2));UU(NNode+L:2*NNode+L-1,1:size(II1,2))]; %The "measurement field" data
0050  U.Electrode=MeasPattern'*[C,zeros(size(C));zeros(size(C)),C]* ...
0051             [UU(NNode+1:NNode+L-1,size(II1,2)+1:size(UU,2));UU(2*NNode+L:size(UU,1), ...
0052             size(II1,2)+1:size(UU,2))];%Voltages on the electrodes
0053  U.Current=[UU(1:NNode,size(II1,2)+1:size(UU,2));UU(NNode+L:2*NNode+L-1,size(II1,2)+1:size(UU,2))]; 
0054 
0055 elseif style=='real'
0056  II1=sparse([zeros(L,NNode),C]);
0057   if ~isempty(MeasPattern) 
0058    II1=MeasPattern'*II1;
0059    II1=II1'; 
0060   else
0061    MeasPattern=eye(max(size(C)));
0062    II1=II1';
0063   end
0064  II=[zeros(NNode,size(T,2));C'*T];
0065 
0066  if nargin<8
0067   p=symmmd(A);
0068   r(p)=1:max(size(p));
0069  end
0070 
0071  R=chol(A(p,p));
0072  UU=R\(R'\[II1(p,:),II(p,:)]);
0073  UU=full(UU(r,:));
0074  U.MeasField=UU(1:NNode,1:size(II1,2)); %The "measurement field" data
0075  U.Electrode=MeasPattern'*C*UU(NNode+1:size(A,1),size(II1,2)+1:size(UU,2));%Voltages on the electrodes
0076  U.Current=UU(1:NNode,size(II1,2)+1:size(UU,2));
0077 end
0078 
0079 
0080 
0081 
0082 
0083 
0084 
0085 
0086 
0087 
0088 
0089 
0090 
0091 
0092

Generated on Tue 09-Aug-2011 11:38:31 by m2html © 2005