function [alpha,N,U]=youxianchafen2(r1,r2,up,under,num,deta)
%[alpha,N,U]=youxianchafen2(a,r1,r2,up,under,num,deta)
%該函數用有限差分法求解有兩種介質的正方形區域的二維拉普拉斯方程的數值解
%函數返回迭代因子、迭代次數以及迭代完成后所求區域內網格節點處的值
%a為正方形求解區域的邊長
%r1,r2分別表示兩種介質的電導率
%up,under分別為上下邊界值
%num表示將區域每邊的網格剖分個數
%deta為迭代過程中所允許的相對誤差限
n=num+1; %每邊節點數
U(n,n)=0; %節點處數值矩陣
N=0; %迭代次數初值
alpha=2/(1+sin(pi/num));%超松弛迭代因子
k=r1/r2; %兩介質電導率之比
U(1,1:n)=up; %求解區域上邊界第一類邊界條件
U(n,1:n)=under; %求解區域下邊界第一類邊界條件
U(2:num,1)=0;U(2:num,n)=0;
for i=2:num
U(i,2:num)=up-(up-under)/num*(i-1);%采用線性賦值對上下邊界之間的節點賦迭代初值
end
G=1;
while G>0 %迭代條件:不滿足相對誤差限要求的節點數目G不為零
Un=U; %完成第n次迭代后所有節點處的值
G=0; %每完成一次迭代將不滿足相對誤差限要求的節點數目歸零
for j=1:n
for i=2:num
U1=U(i,j); %第n次迭代時網格節點處的值
if j==1 %第n+1次迭代左邊界第二類邊界條件
U(i,j)=1/4*(2*U(i,j+1)+U(i-1,j)+U(i+1,j));
end
if (j>1)&&(j U2=1/4*(U(i,j+1)+ U(i-1,j)+ U(i,j-1)+ U(i+1,j));
U(i,j)=U1+alpha*(U2-U1); %引入超松弛迭代因子后的網格節點處的值
end
if i==n+1-j %第n+1次迭代兩介質分界面(與網格對角線重合)第二類邊界條件
U(i,j)=1/4*(2/(1+k)*(U(i,j+1)+U(i+1,j))+2*k/(1+k)*(U(i-1,j)+U(i,j-1)));
end
if j==n %第n+1次迭代右邊界第二類邊界條件
U(i,n)=1/4*(2*U(i,j-1)+U(i-1,j)+U(i+1,j));
end
end
end
N=N+1 %顯示迭代次數
Un1=U; %完成第n+1次迭代后所有節點處的值
err=abs((Un1-Un)./Un1);%第n+1次迭代與第n次迭代所有節點值的相對誤差
err(1,1:n)=0; %上邊界節點相對誤差置零
err(n,1:n)=0; %下邊界節點相對誤差置零
G=sum(sum(err>deta))%顯示每次迭代后不滿足相對誤差限要求的節點數目G
end
LED 線陣顯示裝置, 分為 LED 線性旋轉顯示主機和圖文錄入器兩部分。主機用直流電機帶動由紅綠 LED 組成的線陣旋轉, 同時線陣按照時序依次切換顯示狀態, 在固定區域利用視覺暫留效果形成 16×16 點陣, 用以顯示圖文;圖文錄入器用 HMI 觸控屏作為人機交互界面, 實現圖文錄入和回放功能。主機與圖文錄入器通過無線通信方式進行信息交互,可由圖文錄入器控制主機切換不同工作任務, 以及改變線陣顯示內容。The LED linear array display device is divided into two parts:the one is the main unit used to display content,and the other one is used to input the contents.The main unit is driven by a DC motor to rotate the linear array composed by red and green light emitting diodes.At the same time,the 16×16 dot matrix that switching the display state according to the time sequence on the main unit displays pictures and texts in the fixed area,by using the visual temporary effect.The HMI touch screen is used as human machine interface to realize the function that input and playback pictures and texts.The two parts of the device communicate with each other through wireless communication.The image and text input controller can control the main unit to switch different tasks and change the content of linear array displayed.