From da85b45e7ef40a505ed251ebf9ced972a145a71c Mon Sep 17 00:00:00 2001 From: "dmy@lab" Date: Wed, 23 Sep 2015 19:02:32 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=9D=90=E6=A0=87?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=E7=9A=84bug=202.=E4=BF=AE=E5=A4=8D=E4=BA=86?= =?UTF-8?q?=E8=BF=AD=E4=BB=A3=E6=AD=A5=E9=95=BF=E5=A2=9E=E5=8A=A0=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dmy@lab --- SelfAdaptSimulation.m | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/SelfAdaptSimulation.m b/SelfAdaptSimulation.m index 3fcb2f8..93f61ef 100644 --- a/SelfAdaptSimulation.m +++ b/SelfAdaptSimulation.m @@ -9,21 +9,26 @@ semi_lineDistance=457;% semi_lineCount=4;%分裂数 ConductorX=[-14500,14500];%导线距地高度 ConductorY=[16500,16500];%导线间距 +CSM_N=10;%每一个子导线的模拟电荷数 %% %设置电压 Volt=[500;500;500;500;-500;-500;-500;-500]; +Volt=[500*ones(CSM_N,1);-500*ones(CSM_N,1)]; %按分裂数和分裂导线间距布置单相线路导线 %用极坐标 arc=2*pi/semi_lineCount; +CSM_arc=2*pi/CSM_N; %子导线中心到导线中心的距离 R=semi_lineDistance/2/sin(arc/2); %计算模拟电荷的位置 -r1=-10; +r1=200; error=10000; -for Loop=1:10000 - simulationChargePos=ones(semi_lineCount,1); - for I=1:semi_lineCount - simulationChargePos(I)=exp(1j*((I-1)*arc+arc/2))*(R+r1);%逆时针转一个角度 +step=1/20; +maxLoop=round((R-r1)/step); +for Loop=1:maxLoop; + simulationChargePos=ones(CSM_N,1); + for I=1:CSM_N + simulationChargePos(I)=exp(1j*((I-1)*CSM_arc+CSM_arc/2))*(R+r1);%逆时针转一个角度 end simulationChargeAPos=simulationChargePos+ConductorX(1)+1j*ConductorY(1); simulationChargeBPos=simulationChargePos+ConductorX(2)+1j*ConductorY(2); @@ -47,15 +52,16 @@ for Loop=1:10000 %求电荷 QRI=P\Volt; %以下是验证部分 - if error<0.01 + if error<0.0001 break; end %选检验导线上一个角度 vrfRelA=linspace(0,2*pi)';%vrf=verify %计算检验点相对于子导线的位置 - vrfRelPos=exp(1j*vrfRelA)*r(1); + vrfRelPos=exp(1j*vrfRelA)*R; %移动坐标,使验证的子导线中心和实际子导线中心重合。 vrfPos=exp(1j*(0+arc/2))*R+ConductorX(1)+1j*ConductorY(1)+vrfRelPos; + vrfPos=ConductorX(1)+1j*ConductorY(1)+vrfRelPos; %计算这一点的电位系数 matVrfPos=repmat(vrfPos,1,length(simulationChargePos)); vrf2ConductorDistance=abs(matVrfPos-repmat(conj(simulationChargePos'),length(vrfPos),1)); @@ -64,8 +70,8 @@ for Loop=1:10000 %计算电压 V=Pij*QRI; error=sum(abs(V-500)./500)/length(V); - r1=r1+r(1)/100; + r1=r1+Loop*step; end display('Finished.'); display(Loop); -% scatter(real([simulationChargeAPos;vrfPos]),imag([simulationChargeAPos;vrfPos])); \ No newline at end of file +scatter(real([simulationChargeAPos;vrfPos;ConductorX(1)]),imag([simulationChargeAPos;vrfPos;+1j*ConductorY(1)])); \ No newline at end of file