六重for循环如何优化? 。
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
for ix=1:N+1
x=-1000+(ix-1)*2000/N;
for iy=1:N+1
y=-1000+(iy-1)*2000/N;
Lx(ix,iy)=x;
Ly(ix,iy)=y;
Exx(ix,iy)=0;
Exy(ix,iy)=0;
iip=0;
iiq=0;
for p= -(N-1)/2:(N-1)/2
iip=iip+1;
for q= -(N-1)/2:(N-1)/2
if sqrt(p^2+q^2)>(N-1)/2
continue;
end
iiq=iiq+1;
sitao=asin(2*NA*sqrt(p^2+q^2)/(N-1));
fano=atan2(q,p);
Eopqx(iip,iiq)=0;
Eopqy(iip,iiq)=0;
for m=-(N-1)/2: (N-1)/2
for n=-(N-1)/2: (N-1)/2
if sqrt(m^2+n^2)>(N-1)/2
continue;
end
sitai=asin (2*NA*sqrt(m^2+n^2)/(N-1));
fani=atan2(n,m);
。。。。。。。。。。。。。。。运行速度超级慢,20个数要2个多小时。
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!