222Vol122No1220096JOURNALOFWENSHANTEACHERSCOLLEGEJun12009MATLAB1,2(11,553004;21,663000):MATLAB,,1,,MATLAB;,MATLABPDE1,,MATLAB1:MATLAB;;:O441:A:1671-3303(2009)02-0082-04:2009-02-24:(1976-),,,,11MATLABMathworks[1],1,1,,,,.[2],,[3]1,,MATLAB,12211,1Maxwell,,[4],1,,,1,,,MATLABcontour,1:,U0(U0=100V),a=10cmb=5cm,11,11:z,28,:MATLABz1=0,:9292x+9292y=0(1)(x,y)x=0=0(2)(x,y)x=a=0(3)(x,y)y=0=0(4)(x,y)y=b=U0(5)(1):(x,y)=(A0x+B0)(C0y+D0)+n=1(Ansinknx+Bncosknx)(Cnsinhkny+Dncoshkny)(6):(x,y)=(A0x+B0)(C0y+D0)+n=1(Ansinknx+Bncoshknx)(Cnsinkny+Dncoskny)(7)(2)-(5)(6):(x,y)=4U0n1nsinhnabsinhnaysinnax(8)(8)MATLAB,:cleara=0;[X,Y]=meshgrid(001052,201054);forn=1%b=43100/pi;a=b3sinh(n3pi3Y/2)13sin(n3pi1113X/2)1/n3sinh(n3pi34/2);a=a+a;enda=a;figure%contour(a,20);%21Figure2Distributionofelectricfieldofanalyticalsolution2212,,,1,,1:(),,,,1,,F(x,y)=0,:i,j=14(i,j+1+i,j-1+i-1,j+i+1,j)(9)i,j,i,j+1i-1,ji+1,ji,j-1i,j1(9)MTALAB:clearhx=40;hy=40;%v1=ones(hy,hx);%%Dirichletv1(hy,:)=ones(1,hx)3100;v1(1,:)=zeros(1,hx);%Dirichletfori=1:hyv1(i,1)=0;v1(i,hx)=0;endv2=v1;maxt=1;t=0;k=0while(maxt1e-9)%v1,v2,01000000001k=k+1;%maxt=0;fori=2:hy-1forj=2:hx-1%v2(i,j)=(v1(i,j+1)+v1(i+1,j)111+v2(i-1,j)+v2(i,j-1))/4;t=abs(v2(i,j)-v1(i,j));if(tmaxt)maxt=t;endendendv1=v2;endcontour(v2,20)%3822200923,29891Figure3DistributionofelectricfieldofFDM-numericalsolution3,:holdonx=11hx;y=11hy;[xx,yy]=meshgrid(x,y);%[Gx,Gy]=gradient(-v2,10,10);%quiver(xx,yy,Gx,Gy,8,r)%holdoff213,,1:F()=2kD99x2+99y2dxdy=minL=f(x,y)1,F()1,,11:[5]1,1MATLAB,PDEToolbox1:(1):X-axisrange[040],Y-axisrange[040];(2);(3)Electrostatics();(4)BoundaryModeh=1,r=100,h=1,r=01(5):epsilon1,rho01InitializeMesh,PlotContour,41Arrows1Figure4DistributionofelectricfieldofFEM-numericalsolution43234,MATLAB,1,,x,y,x,y,MATLAB,1,,,11,(8);,,1,1,,14,,MATLAB,48,:MATLAB,1,MATLAB11,[6]1,1[][1]1MATLAB[M]1:,20041[2]1[M]1:,20021[3]P1FERNANDES,P1GIRDINIO1Adaptivefiniteelementa2nalysisof2-DstaticandsteadY-stateelectromagneticproblems[J]1Int1J1Numer1Meth1Engng11999,(45):215-2431[4](),1[M]1:,19981[5]1MATLAB[J]1,2004,(6):105-1091[6],,,1[M]1:,20041AMethodsForSolvingElectromagneticStaticBoundaryValueProblemBasedonMATLABZHUKun1,QIUXue2yun2(11DepartmentofPhysics,GuizhouLiupanshuiTeacherspCollege,LiupanshuiGuizhou553004,China;21TheEditionOfficeofWenShanTeacherspCollege,WenshanYunnan663000,China)Abstract:TheresearchsolvedthestaticelectromagneticfieldboundaryvalueproblemsusingthreedifferentmethodsandtakingMATLABascomputationsaids1Andallthethreeresultswerevisualizedandcompared1Inanalyt2icalmethod,thefunctionofdiscretevalueswereachievedafterthediscreteindependentvariablesbeingputtingintothepost-analyticalsolution,thenrunningMATLABtovisualizeit;inthefinitedifferenceandthefiniteelementmethod,adifferentalgorithmwasusedforsolvingdifferentialequationsdirectly,andtheresultswerevisualizedbyPDEtoolboxandtheprogrammingofMATLAB1Thearticlegavetheprinciplesofthreemethods,stepsandprocessindetail1Inaddition,italsoillustratedtheuseofdifferentmethodsofdealingwithstaticelectromagneticfieldboundaryvalueproblembasedonMATLABinengineeringeducationpossessedofthevalueofextension1Keywords:MATLAB;staticelectromagneticfields;visualization58