when i have a quarter region i wanna got a full region how can i do it?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i have the code that only the quarter region that( +x,+y )area One quadrant
but change or add some code i wanna get full regrion likes (-x,+y,)(-x,-y,)(+x,y)region added
and wanna get a full region
how can i do it?
H=0.05;
NT= 100;
A=2.5; B=2.5; D=0.5; W=1.0;
ER=2.35;
EO=8.81E-12;
U=3.0E+8;
NX=A/H;
NY=B/H;
ND=D/H;
NW=W/H;
VD=100.0;
%CALCULATE CHARGE WITH AND WITHOUT DIELECTRIC
ERR=1.0;
for L=1:2
E1=EO;
E2=EO*ERR;
%INITIALIZATION
V=zeros(NX+2,NY+2);
%SET POTENTIAL ON INNER CONDUCTOR(FIXED NODES) EQUAL TO VD
V(2:NW+1,ND+2)=VD;
%CALCULATE POTENTIAL AT FREE NODES
P1=E1/(2*(E1+E2));
P2=E2/(2*(E1+E2));
for K=1:NT
for I=0:NX-1
for J=0:NY-1
if( (J==ND)&(I<=NW))
%do nothing
elseif(J==ND)
%IMPOSE BOUNDARY CONDITION AT THE INTERFACE
V(I+2,J+2)=0.25*(V(I+3,J+2)+V(I+1,J+2))+....
P1*V(I+2,J+3)+P2*V(I+2,J+1);
elseif(I==0)
%IMPOSE SYMMETRY CONDITION ALONG Y-AXIS
V(I+2,J+2)=(2*V(I+3,J+2)+V(I+2,J+3)+V(I+2,J+1))/4.0;
elseif(J==0)
%IMPOSE SYMMETRY CONDITION ALONG X-AXIS
V(I+2,J+2)=(V(I+3,J+2)+V(I+1,J+2)+2*V(I+2,J+3))/4.0
else
V(I+2,J+2)=(V(I+3,J+2)+V(I+1,J+2)+V(I+2,J+3)+V(I+2,J+1))/4.0;
end
end
end
%Animation of calculation
figure(1),surf(V),colorbar
drawnow
end
2 commentaires
KSSV
le 11 Mai 2021
Shw us your +x and +y....what are they vectors or matrices? It is straight forward....Just multiply by signs as you have shown.
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!