?? current.m
字號:
function [I,T]=Current(L,lg,style,rms,numpat);%Current Supplies some current patterns for 2D EIT% Function [I,T]=Current(L,lg,style,rms,numpat) calculates % different current patterns. The 'style' can be 'tri' (三角形注入), % 'adj' (相鄰注入), 'opp' (相對注入) or 'ref' (一個參考點注入). %% INPUT% L = 電極數% lg =剖分節點數% style = 電流注入模式% rms =注入電流的均方根值. Default=1 (optional).% numpat =電流注入次數(optional, in certain cases forced to be L-1)%% OUTPUT% I = 全電流矩陣包含電極處和內部節點的電流 % T = 電極電流矩陣%****************************if nargin < 4 & style == 'tri' rms=1; numpat=L-1;endif nargin < 4 & style ~= 'tri' rms=1; numpat=L;endif nargin == 4 & style == 'tri' numpat=L-1;endif nargin == 4 & style ~= 'tri' numpat=L;end%****************************switch stylecase 'tri' %三角形注入的電流矩陣計算if numpat > L-1, str=['Too many current patterns. Automatically set to ', num2str(L-1),'.' ]; disp(str) numpat =L-1; endII=zeros(L,numpat);l=(1:L)';th=2*pi*l/L; for k=1:(numpat+1)/2, II(:,k)=rms*cos(k*th); end for k=(numpat+1)/2+1:numpat II(:,k)=rms*sin((k-L/2)*th); endI=[zeros(lg,numpat);II];T=II;case 'adj' %相鄰電極注入的電流矩陣計算II=zeros(L,numpat);l=(1:L)';II1=diag(ones(L,1));II2=diag(ones(L-1,1),-1);if numpat < L II=II1(:,1:numpat)-II2(:,1:numpat);else II=II1(:,1:numpat-1)-II2(:,1:numpat-1); II=[II,[-1;zeros(L-2,1);1]];% Optional!!endI=[zeros(lg,numpat);rms*II];T=II;case 'ref' %參考電極注入的電流矩陣計算 if numpat > L-1, str=['Too many current patterns. Automatically set to ', num2str(L-1),'.' ]; disp(str) numpat =L-1; endII=zeros(L,numpat);II1=diag(ones(L-1,1),-1);II(1,:)=ones(1,numpat);T=II-II1(:,1:numpat);I=[zeros(lg,numpat);rms*T];case 'opp' %相對電極注入的電流矩陣計算if numpat > L/2, str=['Too many current patterns. Automatically set to ', num2str(L/2),'.' ]; disp(str)numpat=L/2;endII=zeros(L,numpat);l=(1:L)';II1=diag(ones(L,1));II2=diag(ones(L,1),-8);II=II1(:,1:numpat)-II2(1:L,1:numpat);%II=[II(:,1:ceil(numpat/2)),-II(:,1:floor(numpat/2))];% Optional!!I=[zeros(lg,numpat);rms*II];T=II;end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -